Re: [PATCH v2] tools/sdptool: Fix NULL pointer dereference

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

 



Hi Szymon,

On Tue, Jul 28, 2015, Szymon Janc wrote:
> > > -	void **dtdArray;
> > > -	void **valueArray;
> > > -	void **allocArray;
> > > +	void **dtdArray = NULL;
> > > +	void **valueArray = NULL;
> > > +	void **allocArray = NULL;
> > 
> > This doesn't seem to be related to fixing missing malloc failure checks.
> > It's also unnecessary since all of these either way get unconditionally
> > assigned to before reading the values.
> 
> Those are due to 'goto cleanup' where all pointers are freed.

Right. I was looking at the existing code and forgot that the patch adds
this label.

> But we could make this code a bit simpler with:
> 
> foo = malloc();
> bar = malloc();
> if (!foo || !bar)
>   goto cleanup;
> 
> Then initialization is not needed.

Agreed.

Johan
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux