[PATCH] error.c: fix gcc warning (vasprintf)

Alexey Tourbin <[email protected]>
Newsgroups gmane.comp.web.links
Message-ID <[email protected]>
---
 src/util/error.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/src/util/error.c b/src/util/error.c
index 0c2d1cd..8164f82 100644
--- a/src/util/error.c
+++ b/src/util/error.c
@@ -145,13 +145,18 @@ void
 elinks_assertm(int x, unsigned char *fmt, ...)
 {
 	unsigned char *buf = NULL;
+	int rv;
 	va_list params;
 
 	if (assert_failed) return;
 	if (!(assert_failed = !x)) return;
 
 	va_start(params, fmt);
-	vasprintf((char **) &buf, fmt, params);
+	rv = vasprintf((char **) &buf, fmt, params);
+	if (rv < 0) {
+		perror("vasprintf");
+		return;
+	}
 	va_end(params);
 	elinks_internal("assertion failed: %s", buf);
 	if (buf) free(buf);
-- 
1.5.0.1.GIT
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.