From: Zhiqiang Liu Date: Mon, 27 Jul 2020 09:46:01 +0000 (+0800) Subject: libusb: fix a memory leak in sunos_new_string_list func X-Git-Tag: upstream/1.0.24~58 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f85dfa654f26d02a3ef3d955ed41bd98b710bd23;p=platform%2Fupstream%2Flibusb.git 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 Signed-off-by: Chris Dickens --- 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 @@ sunos_new_string_list(void) 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