> -----Original Message----- > From: David Laight [mailto:David.Laight@xxxxxxxxxx] > Sent: Wednesday, April 02, 2014 3:03 PM > To: Krzysztof Opasiak; mporter@xxxxxxxxxx; linux- > usb@xxxxxxxxxxxxxxx > Cc: Andrzej Pietrasiewicz; Karol Lewandowski; Stanislaw Wadas; > ty317.kim@xxxxxxxxxxx; 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 majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html