Pino Toscano
2014-Sep-10 11:13 UTC
[Libguestfs] [PATCH] fish: fix small memory leak in completion
Do not leak the small memory buffer with the path. --- fish/destpaths.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fish/destpaths.c b/fish/destpaths.c index 9c97bf0..f224106 100644 --- a/fish/destpaths.c +++ b/fish/destpaths.c @@ -154,7 +154,8 @@ complete_dest_paths_generator (const char *text, int state) /* If we've got a partial path already, we need to list everything * in that directory, otherwise list everything in / */ - char *p, *dir; + CLEANUP_FREE char *dir = NULL; + char *p; struct guestfs_dirent_list *dirents; p = strrchr (text, '/'); -- 1.9.3
Richard W.M. Jones
2014-Sep-10 16:23 UTC
Re: [Libguestfs] [PATCH] fish: fix small memory leak in completion
On Wed, Sep 10, 2014 at 01:13:06PM +0200, Pino Toscano wrote:> Do not leak the small memory buffer with the path. > --- > fish/destpaths.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/fish/destpaths.c b/fish/destpaths.c > index 9c97bf0..f224106 100644 > --- a/fish/destpaths.c > +++ b/fish/destpaths.c > @@ -154,7 +154,8 @@ complete_dest_paths_generator (const char *text, int state) > /* If we've got a partial path already, we need to list everything > * in that directory, otherwise list everything in / > */ > - char *p, *dir; > + CLEANUP_FREE char *dir = NULL; > + char *p; > struct guestfs_dirent_list *dirents; > > p = strrchr (text, '/'); > -- > 1.9.3Looks good, ACK. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top