summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaweł Szewczyk <p.szewczyk@samsung.com>2018-03-21 17:59:01 +0100
committerPaweł Szewczyk <p.szewczyk@samsung.com>2018-04-09 14:23:55 +0200
commit834135cf60aa15ccb76d676f3f7f7bc1a9cf23ca (patch)
tree3b2576ec4145522581c7a03c215ec89c8e720406
parent6ad242f98a744df1ea258a340213ff688aad941e (diff)
downloaddevice-manager-plugin-artik-834135cf60aa15ccb76d676f3f7f7bc1a9cf23ca.tar.gz
device-manager-plugin-artik-834135cf60aa15ccb76d676f3f7f7bc1a9cf23ca.tar.bz2
device-manager-plugin-artik-834135cf60aa15ccb76d676f3f7f7bc1a9cf23ca.zip
Fix minor issues
Change-Id: I78dd77f031b4cda871a758687d4518a5ac22dc43 Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
-rw-r--r--hw/usb_client/usb_client_configfs.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/hw/usb_client/usb_client_configfs.c b/hw/usb_client/usb_client_configfs.c
index d48ae0d..deaafcd 100644
--- a/hw/usb_client/usb_client_configfs.c
+++ b/hw/usb_client/usb_client_configfs.c
@@ -375,7 +375,7 @@ free_current:
free(usb_gadget->configs[i]);
clean_prev:
while (i >= 0)
- cfs_free_config(usb_gadget->configs[i]);
+ cfs_free_config(usb_gadget->configs[i--]);
return ret;
}
@@ -473,9 +473,9 @@ free_funcs:
free(usb_funcs);
free_strs_with_content:
for (i = 0; usb_gadget->strs[i].lang_code; ++i) {
- free(usb_gadget->strs[0].manufacturer);
- free(usb_gadget->strs[0].product);
- free(usb_gadget->strs[0].serial);
+ free(usb_gadget->strs[i].manufacturer);
+ free(usb_gadget->strs[i].product);
+ free(usb_gadget->strs[i].serial);
}
free_strs:
free(usb_gadget->strs);
@@ -820,7 +820,8 @@ static int cfs_set_gadget_config(struct cfs_client *cfs_client,
type = usbg_lookup_function_type(usb_func->name);
if (strlen(usb_func->instance) >= MAX_INSTANCE_LEN)
return -ENAMETOOLONG;
- strcpy(instance, usb_func->instance);
+ strncpy(instance, usb_func->instance, MAX_INSTANCE_LEN);
+ instance[MAX_INSTANCE_LEN - 1] = '\0';
break;
case USB_FUNCTION_GROUP_WITH_SERVICE:
type = USBG_F_FFS;