libusb: fix a memory leak in sunos_new_string_list func
In sunos_new_string_list func, if alloc list->string fails,
we will return NULL without free list, which has alread been
allocated successfully.
Fixes: 17348731b4 ('Solaris backend depends on Solaris private symbols')
Closes #756
Signed-off-by: Zhiqiang Liu <lzhq28@mail.ustc.edu.cn>
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
diff --git a/libusb/os/sunos_usb.c b/libusb/os/sunos_usb.c
index 3e2fb4f..73b96da 100644
--- a/libusb/os/sunos_usb.c
+++ b/libusb/os/sunos_usb.c
@@ -248,8 +248,10 @@
if (list == NULL)
return (NULL);
list->string = calloc(DEFAULT_LISTSIZE, sizeof(char *));
- if (list->string == NULL)
+ if (list->string == NULL) {
+ free(list);
return (NULL);
+ }
list->nargs = 0;
list->listsize = DEFAULT_LISTSIZE;
diff --git a/libusb/version_nano.h b/libusb/version_nano.h
index ea0c971..baac006 100644
--- a/libusb/version_nano.h
+++ b/libusb/version_nano.h
@@ -1 +1 @@
-#define LIBUSB_NANO 11525
+#define LIBUSB_NANO 11526