summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2014-05-06 20:49:51 +0200
committerGravatar Nikias Bassen2014-05-06 20:49:51 +0200
commit232767840fcad6aa1c8958dc9d1a597f010af034 (patch)
treecd9c1a521d1cbf56643f19a73e0c6629eca1f5e5
parent6340b3519aae212d7ffa6d0ea4ebcab7c6615eec (diff)
downloadlibusbmuxd-232767840fcad6aa1c8958dc9d1a597f010af034.tar.gz
libusbmuxd-232767840fcad6aa1c8958dc9d1a597f010af034.tar.bz2
Make sure to close socket if usbmuxd_get_device_list() errors out
-rw-r--r--src/libusbmuxd.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/libusbmuxd.c b/src/libusbmuxd.c
index 725ed53..2379452 100644
--- a/src/libusbmuxd.c
+++ b/src/libusbmuxd.c
@@ -846,6 +846,7 @@ retry:
usbmuxd_device_info_t *devinfo = device_info_from_device_record(dev);
free(dev);
if (!devinfo) {
+ socket_close(sfd);
DEBUG(1, "%s: can't create device info object\n", __func__);
plist_free(list);
return -1;
@@ -886,6 +887,7 @@ retry:
}
if (!listen_success) {
+ socket_close(sfd);
DEBUG(1, "%s: Could not send listen request!\n", __func__);
return -1;
}
@@ -900,6 +902,7 @@ retry:
usbmuxd_device_info_t *devinfo = device_info_from_device_record(dev);
if (!devinfo) {
+ socket_close(sfd);
DEBUG(1, "%s: can't create device info object\n", __func__);
free(payload);
return -1;