Hello.
On 06/10/2014 07:57 PM, Krzysztof Opasiak wrote:
Memory allocated with asprintf() for variable path
could be not free() in some cases. Fix this issue by
doing some small refactoring.
Signed-off-by: Krzysztof Opasiak <[email protected]>
---
src/usbg.c | 34 +++++++++++++++++++++++-----------
1 file changed, 23 insertions(+), 11 deletions(-)
diff --git a/src/usbg.c b/src/usbg.c
index edb7fc3..054c603 100644
--- a/src/usbg.c
+++ b/src/usbg.c
[...]
@@ -1227,21 +1228,32 @@ int usbg_init(char *configfs_path, usbg_state **state)
[...]
+ ret = usbg_init_state(path, s);
+ if (ret != USBG_SUCCESS) {
+ ERRORNO("couldn't init gadget state\n");
+ usbg_free_state(s);
+ goto out;
+ }
+
+ *state = s;
+out:
+ return ret;
+
+err:
+ free(path);
Why not put the 'out' label here and not duplicate *return*?
return ret;
}
WBR, Sergei
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html