[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[fedora-virt] [PATCH libguestfs] daemon/readdir: avoid a small leak




>From 1b85f07c6aa5f4877ac066aed9c2341782b7f1fe Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering redhat com>
Date: Fri, 3 Jul 2009 11:52:19 +0200
Subject: [PATCH libguestfs] daemon/readdir: avoid a small leak

* daemon/readdir.c (do_readdir): Free both p and v.name, in case
only one of the allocations failed.
---
 daemon/readdir.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/daemon/readdir.c b/daemon/readdir.c
index cea6fdd..38bc66e 100644
--- a/daemon/readdir.c
+++ b/daemon/readdir.c
@@ -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;
--
1.6.3.3.507.gc6b5a


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]