[fedora-virt] [PATCH libguestfs] daemon/readdir: avoid a small leak
Richard W.M. Jones
rjones at redhat.com
Fri Jul 3 14:37:53 UTC 2009
On Fri, Jul 03, 2009 at 03:10:17PM +0200, Jim Meyering wrote:
>
>
> >From 1b85f07c6aa5f4877ac066aed9c2341782b7f1fe Mon Sep 17 00:00:00 2001
> From: Jim Meyering <meyering at 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
+1
--
Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones
virt-p2v converts physical machines to virtual machines. Boot with a
live CD or over the network (PXE) and turn machines into Xen guests.
http://et.redhat.com/~rjones/virt-p2v
More information about the virt
mailing list