Re: [PATCH 26/74] libss: fix memory handling errors

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

 



On Tue, Dec 17, 2013 at 11:04:15AM -0600, Eric Sandeen wrote:
> On 12/10/13, 7:21 PM, Darrick J. Wong wrote:
> > Fix memory allocation calculations and check for NULL pointer returns.
> > 
> > Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
> > ---
> >  lib/ss/invocation.c  |    5 +++++
> >  lib/ss/parse.c       |    4 ++++
> >  lib/ss/request_tbl.c |    2 +-
> >  3 files changed, 10 insertions(+), 1 deletion(-)
> > 
> > 
> > diff --git a/lib/ss/invocation.c b/lib/ss/invocation.c
> > index a711050..08b66f2 100644
> > --- a/lib/ss/invocation.c
> > +++ b/lib/ss/invocation.c
> > @@ -20,6 +20,7 @@
> >  #ifdef HAVE_DLOPEN
> >  #include <dlfcn.h>
> >  #endif
> > +#include <errno.h>
> >  
> >  int ss_create_invocation(subsystem_name, version_string, info_ptr,
> >  			 request_table_ptr, code_ptr)
> > @@ -46,6 +47,10 @@ int ss_create_invocation(subsystem_name, version_string, info_ptr,
> >  		;
> >  	table = (ss_data **) realloc((char *)table,
> >  				     ((unsigned)sci_idx+2)*size);
> > +	if (table == NULL) {
> > +		*code_ptr = errno;
> > +		return 0;
> > +	}
> 
> According to coverity CID 295143, this leaks "new_table"
> 
> Just a free() before return would suffice I think.

All right, I'll send out a couple of cleanup patches in a bit.

--D
> 
> Thanks,
> -Eric
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux