Re: [PATCH v2 1/4] xfsprogs: xfs_io: fix a memory leak in imap_f

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

 



On Sun, Dec 20, 2015 at 07:33:57AM -0800, Christoph Hellwig wrote:
> > @@ -39,6 +39,8 @@ imap_f(int argc, char **argv)
> > -		if (count == 0)
> > +		if (count == 0) {
> > +			free(t);
> >  			return 0;
> > +		}
> 
> please use a goto out_free; here
> 
> >
> >  		for (i = 0; i < count; i++) {
> >  			printf(_("ino %10llu count %2d mask %016llx\n"),
> >  				(unsigned long long)t[i].xi_startino,
> > @@ -55,6 +59,7 @@ imap_f(int argc, char **argv)
> >  				(unsigned long long)t[i].xi_allocmask);
> >  		}
> >  	}
> > +	free(t);
> >  	perror("xfsctl(XFS_IOC_FSINUMBERS)");
> >  	exitcode = 1;
> >  	return 0;
> 
> and place the free just before the return here so that we have a single
> uwinding exit.

<sigh>

I'll just make the change locally, given I *was* only 15 minutes
away from pushing this into the public repository.

-Dave.
-- 
Dave Chinner
david@xxxxxxxxxxxxx

_______________________________________________
xfs mailing list
xfs@xxxxxxxxxxx
http://oss.sgi.com/mailman/listinfo/xfs



[Index of Archives]     [Linux XFS Devel]     [Linux Filesystem Development]     [Filesystem Testing]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux