From: Eric Sandeen Date: Mon, 15 Sep 2014 23:18:21 +0000 (+1000) Subject: xfs_io: free fshandlep in parent_check() X-Git-Tag: v3.2.2~25 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=713ba3f2c7f6d28a78df4e774cb8c3bd9ff12154;p=thirdparty%2Fxfsprogs-dev.git xfs_io: free fshandlep in parent_check() The allocated fshandle wasn't freed in either normal exit or error paths. Do this, and consolidate cleanup into an out: target. Signed-off-by: Eric Sandeen Reviewed-by: Brian Foster Signed-off-by: Dave Chinner --- diff --git a/io/parent.c b/io/parent.c index ca989e960..56e126d32 100644 --- a/io/parent.c +++ b/io/parent.c @@ -258,9 +258,8 @@ parent_check(void) if (!bstatbuf || !parentbuf) { fprintf(stderr, _("unable to allocate buffers: %s\n"), strerror(errno)); - free(bstatbuf); - free(parentbuf); - return 1; + err_status = 1; + goto out; } if (do_bulkstat(parentbuf, &parentbuf_size, bstatbuf, fsfd, fshandlep) != 0) @@ -272,8 +271,10 @@ parent_check(void) printf(_("succeeded checking %llu inodes\n"), (unsigned long long) inodes_checked); +out: free(bstatbuf); free(parentbuf); + free(fshandlep); return err_status; }