[Spice-devel] [usbredir v1] usbredirhost: fix leak on error

Victor Toso victortoso at redhat.com
Wed Aug 3 16:11:43 UTC 2016


Pointed by coverity:
 17. usbredir-0.7.1/usbredirhost/usbredirhost.c:2306: leaked_storage:
 Returning without freeing "data" leaks the storage that it points to.
 #  2304|
 #  usbredirhost_bulk_packet_complete(transfer->transfer);
 #  2305|       }
 #  2306|-> }
 #  2307|
 #  2308|   static void usbredirhost_iso_packet(void *priv, uint64_t
 #  id,
---
 usbredirhost/usbredirhost.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/usbredirhost/usbredirhost.c b/usbredirhost/usbredirhost.c
index 3e80677..2b3ee74 100644
--- a/usbredirhost/usbredirhost.c
+++ b/usbredirhost/usbredirhost.c
@@ -2280,6 +2280,7 @@ static void usbredirhost_bulk_packet(void *priv, uint64_t id,
                                          transfer, BULK_TIMEOUT);
 #else
         r = LIBUSB_ERROR_INVALID_PARAM;
+        free(buffer);
         goto error;
 #endif
     } else {
-- 
2.7.4



More information about the Spice-devel mailing list