diff options
author | Michael Plante <michael.plante@gmail.com> | 2010-01-23 18:28:50 -0600 |
---|---|---|
committer | Pete Batard <pbatard@gmail.com> | 2010-01-24 22:41:41 +0000 |
commit | 5869484e213fc599992702d18561df04d296aff3 (patch) | |
tree | d1b02e27fbb38f0e47133240ddc50f5625449c98 /libusb | |
parent | 628bd43bc24319f82a6ca63265b55adce438c9b5 (diff) | |
download | libusb-5869484e213fc599992702d18561df04d296aff3.tar.gz |
r106: Fixed leak in usbi_alloc_device when pthread_mutex_init fails
Diffstat (limited to 'libusb')
-rw-r--r-- | libusb/core.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libusb/core.c b/libusb/core.c index 6adf67e..7455bbb 100644 --- a/libusb/core.c +++ b/libusb/core.c @@ -521,8 +521,10 @@ struct libusb_device *usbi_alloc_device(struct libusb_context *ctx, return NULL; r = pthread_mutex_init(&dev->lock, NULL); - if (r) + if (r) { + free(dev); return NULL; + } dev->ctx = ctx; dev->refcnt = 1; |