[PATCH v2 3/4] libusbg: Do not try to dereference func when it is NULL. CID#56127

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

 



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>
---
 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




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux