[Spice-devel] [PATCH] Fix leaks

Fabiano Fidêncio fidencio at redhat.com
Tue Jul 15 16:24:25 PDT 2014


---
 usbredirhost/usbredirhost.c             | 1 +
 usbredirtestclient/usbredirtestclient.c | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/usbredirhost/usbredirhost.c b/usbredirhost/usbredirhost.c
index bbaafa4..6ab6e1b 100644
--- a/usbredirhost/usbredirhost.c
+++ b/usbredirhost/usbredirhost.c
@@ -1191,6 +1191,7 @@ static void usbredirhost_alloc_stream_unlocked(struct usbredirhost *host,
                 host->endpoint[EP2I(ep)].transfer[i], INTERRUPT_TIMEOUT);
             break;
         }
+        free(buffer);
     }
     host->endpoint[EP2I(ep)].out_idx = 0;
     host->endpoint[EP2I(ep)].drop_packets = 0;
diff --git a/usbredirtestclient/usbredirtestclient.c b/usbredirtestclient/usbredirtestclient.c
index 42b16dc..32fcba2 100644
--- a/usbredirtestclient/usbredirtestclient.c
+++ b/usbredirtestclient/usbredirtestclient.c
@@ -404,6 +404,9 @@ static int usbredirtestclient_cmdline_ctrl(void)
     }
     usbredirparser_send_control_packet(parser, id, &control_packet,
                                        data, data_len);
+    if (data) {
+        free(data);
+    }
     printf("Send control packet with id: %u\n", id);
     id++;
     return 1;
-- 
1.9.3



More information about the Spice-devel mailing list