Index: uspace/lib/c/generic/vbd.c
===================================================================
--- uspace/lib/c/generic/vbd.c	(revision 2a09dcb306884fcb1ded541284a93d92e6da3853)
+++ uspace/lib/c/generic/vbd.c	(revision a43febeb923251c5d920f8ffc446ea730559f02d)
@@ -231,7 +231,10 @@
 
 		alloc_size = act_size;
-		ids = realloc(ids, alloc_size);
-		if (ids == NULL)
+		service_id_t *tmp = realloc(ids, alloc_size);
+		if (tmp == NULL) {
+			free(ids);
 			return ENOMEM;
+		}
+		ids = tmp;
 	}
 
