summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Meissner <marcus@jet.franken.de>2016-02-06 17:04:29 +0100
committerMarcus Meissner <marcus@jet.franken.de>2016-02-06 17:04:29 +0100
commit434d85677e020352e742b64eee54d10536f3918e (patch)
tree859343ec8e01501184c950044dbc4d90d91279ad
parent7b011db764a852d1b3821e30ee1c2f1c4ea9f51c (diff)
downloadlibgphoto2-434d85677e020352e742b64eee54d10536f3918e.tar.gz
removed some leaks on error exits (Coverity)
CID 1033377 Resource leak
-rw-r--r--libgphoto2_port/libusb1/libusb1.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/libgphoto2_port/libusb1/libusb1.c b/libgphoto2_port/libusb1/libusb1.c
index 5678f0176..2f671ba5a 100644
--- a/libgphoto2_port/libusb1/libusb1.c
+++ b/libgphoto2_port/libusb1/libusb1.c
@@ -303,6 +303,11 @@ gp_port_library_list (GPPortInfoList *list)
gp_port_info_set_path (info, path);
C_GP (gp_port_info_list_append (list, info));
}
+
+ libusb_free_device_list (devs, 1);
+ libusb_exit (ctx); /* should free all stuff above */
+ free (descs);
+
/* This will only be added if no other device was ever added.
* Users doing "usb:" usage will enter the regular expression matcher case. */
if (nrofdevices == 0) {
@@ -312,9 +317,6 @@ gp_port_library_list (GPPortInfoList *list)
gp_port_info_set_path (info, "usb:");
C_GP (gp_port_info_list_append (list, info));
}
- libusb_free_device_list (devs, 1);
- libusb_exit (ctx); /* should free all stuff above */
- free (descs);
return (GP_OK);
}