- 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);
type = usbg_lookup_function_type(usb_func->name);
if (strlen(usb_func->instance) >= MAX_INSTANCE_LEN)
return -ENAMETOOLONG;
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';