[PATCH 01/12] libusbg: Return USBG_ERROR_PATH_TOO_LONG error when it happens

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

 



From: Philippe De Swert <philippe.deswert@xxxxxxxxxxxxxxx>

Signed-off-by: Philippe De Swert <philippe.deswert@xxxxxxxxxxxxxxx>
Acked-by: Krzysztof Opasiak <k.opasiak@xxxxxxxxxxx>
Signed-off-by: Krzysztof Opasiak <k.opasiak@xxxxxxxxxxx>

Update commit message.

Signed-off-by: Krzysztof Opasiak <k.opasiak@xxxxxxxxxxx>
---
 src/usbg.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/usbg.c b/src/usbg.c
index 1703ff1..bbba689 100644
--- a/src/usbg.c
+++ b/src/usbg.c
@@ -2023,7 +2023,7 @@ int usbg_create_config(usbg_gadget *g, int id, const char *label,
 		usbg_config_attrs *c_attrs, usbg_config_strs *c_strs, usbg_config **c)
 {
 	char cpath[USBG_MAX_PATH_LENGTH];
-	usbg_config *conf;
+	usbg_config *conf = NULL;
 	int ret = USBG_ERROR_INVALID_PARAM;
 	int n, free_space;
 
@@ -2060,6 +2060,8 @@ int usbg_create_config(usbg_gadget *g, int id, const char *label,
 	n = snprintf(&(cpath[n]), free_space, "/%s", (*c)->name);
 	if (n < free_space) {
 		ret = USBG_ERROR_PATH_TOO_LONG;
+		usbg_free_config(conf);
+		goto out;
 	}
 
 	ret = mkdir(cpath, S_IRWXU | S_IRWXG | S_IRWXO);
-- 
1.7.9.5

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