From: Alexandru Gagniuc Date: Thu, 20 Dec 2012 03:39:38 +0000 (-0600) Subject: device.c: Fix memory leak in sr_serial_dev_inst_free X-Git-Tag: dsupstream~427 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=acac8fc3500bc1f1e9e43c1508638488d91b2f86;p=libsigrok.git device.c: Fix memory leak in sr_serial_dev_inst_free 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 --- diff --git a/device.c b/device.c index f437c18a..fc8477a1 100644 --- 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); }