summaryrefslogtreecommitdiffstats
path: root/libusbmuxd
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2012-01-17 23:32:49 +0100
committerGravatar Nikias Bassen2012-01-17 23:32:49 +0100
commit94c2752bef5fe1c3954e6801ae3e30ed9c16165a (patch)
tree93d192a492235f71a2acea35ae2f2da16ed02e59 /libusbmuxd
parent8968476bb5262d8aef20cb199337b174d338beb8 (diff)
downloadusbmuxd-94c2752bef5fe1c3954e6801ae3e30ed9c16165a.tar.gz
usbmuxd-94c2752bef5fe1c3954e6801ae3e30ed9c16165a.tar.bz2
libusbmuxd: free device info after removing it from collection
Diffstat (limited to 'libusbmuxd')
-rw-r--r--libusbmuxd/libusbmuxd.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libusbmuxd/libusbmuxd.c b/libusbmuxd/libusbmuxd.c
index 98e92df..a6a8c86 100644
--- a/libusbmuxd/libusbmuxd.c
+++ b/libusbmuxd/libusbmuxd.c
@@ -71,6 +71,7 @@ static usbmuxd_event_cb_t event_cb = NULL;
HANDLE devmon = NULL;
#else
pthread_t devmon;
+pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
#endif
static int listenfd = -1;
@@ -526,6 +527,7 @@ int get_next_event(int sfd, usbmuxd_event_cb_t callback, void *user_data)
FOREACH(usbmuxd_device_info_t *dev, &devices) {
generate_event(callback, dev, UE_DEVICE_REMOVE, user_data);
collection_remove(&devices, dev);
+ free(dev);
} ENDFOREACH
return -EIO;
}
@@ -563,6 +565,7 @@ int get_next_event(int sfd, usbmuxd_event_cb_t callback, void *user_data)
} else {
generate_event(callback, devinfo, UE_DEVICE_REMOVE, user_data);
collection_remove(&devices, devinfo);
+ free(devinfo);
}
} else {
fprintf(stderr, "%s: Unexpected message type %d length %d received!\n", __func__, hdr.message, hdr.length);