Index: uspace/lib/c/generic/sysinfo.c
===================================================================
--- uspace/lib/c/generic/sysinfo.c	(revision c3d4bb457c89cf2c85195cda220c37d624d7625f)
+++ uspace/lib/c/generic/sysinfo.c	(revision bbda5ab736025c36aa1ad4f3179adec67abe36e3)
@@ -103,15 +103,18 @@
 	   in common cases. */
 	
+	void *data = NULL;
+	
 	while (true) {
 		/* Get the binary data size */
 		int ret = sysinfo_get_data_size(path, size);
-		if (ret != EOK) {
-			/* Not binary data item */
-			return NULL;
+		if ((ret != EOK) || (size == 0)) {
+			/* Not a binary data item
+			   or an empty item */
+			break;
 		}
 		
-		void *data = malloc(*size);
+		data = realloc(data, *size);
 		if (data == NULL)
-			return NULL;
+			break;
 		
 		/* Get the data */
@@ -121,13 +124,16 @@
 			return data;
 		
-		/* Dispose the buffer */
-		free(data);
-		
 		if (ret != ENOMEM) {
 			/* The failure to get the data was not caused
 			   by wrong buffer size */
-			return NULL;
+			break;
 		}
 	}
+	
+	if (data != NULL)
+		free(data);
+	
+	*size = 0;
+	return NULL;
 }
 
