daemon/readdir: avoid a small leak
authorJim Meyering <meyering@redhat.com>
Fri, 3 Jul 2009 09:52:19 +0000 (11:52 +0200)
committerJim Meyering <meyering@redhat.com>
Fri, 3 Jul 2009 15:04:21 +0000 (17:04 +0200)
* daemon/readdir.c (do_readdir): Free both p and v.name, in case
only one of the allocations failed.

daemon/readdir.c

index cea6fdd..38bc66e 100644 (file)
@@ -68,6 +68,8 @@ do_readdir (char *path)
     if (!p || !v.name) {
       reply_with_perror ("allocate");
       free (ret->guestfs_int_dirent_list_val);
+      free (p);
+      free (v.name);
       free (ret);
       closedir (dir);
       return NULL;