> -----Original Message----- > From: linux-usb-owner@xxxxxxxxxxxxxxx [mailto:linux-usb- > owner@xxxxxxxxxxxxxxx] On Behalf Of philippedeswert@xxxxxxxxx > Sent: Saturday, May 24, 2014 7:29 PM > To: philippedeswert@xxxxxxxxx; linux-usb@xxxxxxxxxxxxxxx > Subject: [PATCH v3 3/4] libusbg: Do not try to dereference func > when it is NULL. CID#56127 > > From: Philippe De Swert <philippe.deswert@xxxxxxxxxxxxxxx> > > We check if func is NULL, so if the allocation function failed we > should > not dereference or handle it anymore, so we jump straight to the > end. > > Signed-off-by: Philippe De Swert <philippe.deswert@xxxxxxxxxxxxxxx> Reviewed-by: Krzysztof Opasiak <k.opasiak@xxxxxxxxxxx> > --- > src/usbg.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/src/usbg.c b/src/usbg.c > index 66aa435..8ad6a9e 100644 > --- a/src/usbg.c > +++ b/src/usbg.c > @@ -1653,6 +1653,7 @@ int usbg_create_function(usbg_gadget *g, > usbg_function_type type, > if (!func) { > ERRORNO("allocating function\n"); > ret = USBG_ERROR_NO_MEM; > + goto out; > } > > free_space = sizeof(fpath) - n; > -- > 1.8.1.2 > > -- > 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 -- 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