]> sigrok.org Git - libsigrok.git/commitdiff
device.c: Fix memory leak in sr_serial_dev_inst_free
authorAlexandru Gagniuc <redacted>
Thu, 20 Dec 2012 03:39:38 +0000 (21:39 -0600)
committerUwe Hermann <redacted>
Sun, 23 Dec 2012 16:18:14 +0000 (17:18 +0100)
sr_serial_dev_inst_free() freed all members of sr_serial_dev_inst, but did not
free the struct itself, as expected from a free_*() function. This inadvertently
caused a memory leak in every place sr_serial_dev_inst is used.

Free the struct itself

+ g_free(serial);

Signed-off-by: Alexandru Gagniuc <redacted>
device.c

index f437c18a5fdb88e544fc4cdc1821070f641083c5..fc8477a1cec894a89a392c59403846c38e5ff2bd 100644 (file)
--- a/device.c
+++ b/device.c
@@ -325,6 +325,7 @@ SR_PRIV void sr_serial_dev_inst_free(struct sr_serial_dev_inst *serial)
 
        g_free(serial->port);
        g_free(serial->serialcomm);
+       g_free(serial);
 
 }