> -----Original Message-----
> From: David Laight [mailto:david.lai...@aculab.com]
> Sent: Wednesday, April 02, 2014 3:03 PM
> To: Krzysztof Opasiak; mpor...@linaro.org; linux-
> u...@vger.kernel.org
> Cc: Andrzej Pietrasiewicz; Karol Lewandowski; Stanislaw Wadas;
> ty317....@samsung.com; Marek Szyprowski; Robert Baldyga
> Subject: RE: [PATCH 2/5] libusbg: Fix wrong malloc sizes in
> allocate functions.
> 
> From: Krzysztof Opasiak
> > Functions usbg_allocate_function() and usbg_allocate_binding()
> > had allocated sizeof(usbg_config) instead of usbg_function
> > and usbg_binding.
> ...
> >     usbg_function *f;
> >
> > -   f = malloc(sizeof(usbg_config));
> > +   f = malloc(sizeof(usbg_function));
> 
> Use the much safer:
>       f = malloc(sizeof (*f));

Really good idea. Will be changed in v2.

--
BR's
Krzysiek
 
 



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

Reply via email to