Blob Blame Raw
diff -up libnl-1.0-pre8/include/netlink-local.h.use-vasprintf-retval libnl-1.0-pre8/include/netlink-local.h
--- libnl-1.0-pre8/include/netlink-local.h.use-vasprintf-retval	2007-12-03 14:13:52.000000000 -0500
+++ libnl-1.0-pre8/include/netlink-local.h	2007-12-03 14:15:26.000000000 -0500
@@ -273,13 +273,18 @@ static inline void __dp_dump(struct nl_d
 		vfprintf(parms->dp_fd, fmt, args);
 	else if (parms->dp_buf || parms->dp_cb) {
 		char *buf = NULL;
-		vasprintf(&buf, fmt, args);
-		if (parms->dp_cb)
-			parms->dp_cb(parms, buf);
-		else
-			strncat(parms->dp_buf, buf,
-			        parms->dp_buflen - strlen(parms->dp_buf) - 1);
-		free(buf);
+		int ret;
+		ret = vasprintf(&buf, fmt, args);
+		if (ret >= 0) {
+			if (parms->dp_cb)
+				parms->dp_cb(parms, buf);
+			else
+				strncat(parms->dp_buf, buf,
+				        parms->dp_buflen - strlen(parms->dp_buf) - 1);
+			free(buf);
+		} else {
+			// FIXME: indicate error somehow
+		}
 	}
 }