From: Philippe De Swert <philippe.desw...@jollamobile.com>

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.desw...@jollamobile.com>
---
 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 majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to