match.name is strdup'd() and needs to be freed on exit. If we use the match,
libwacom_copy_match() will strdup again anyway.

Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net>
---
 libwacom/libwacom.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libwacom/libwacom.c b/libwacom/libwacom.c
index 8fe7baf..d912f25 100644
--- a/libwacom/libwacom.c
+++ b/libwacom/libwacom.c
@@ -805,8 +805,7 @@ libwacom_update_match(WacomDevice *device, const char 
*name, WacomBusType bus, i
        for (i = 0; i < device->nmatches; i++) {
                if 
(g_strcmp0(libwacom_match_get_match_string(device->matches[i]), newmatch) == 0) 
{
                        device->match = i;
-                       g_free(newmatch);
-                       return;
+                       goto out;
                }
        }
 
@@ -816,7 +815,9 @@ libwacom_update_match(WacomDevice *device, const char 
*name, WacomBusType bus, i
        device->matches[device->nmatches] = NULL;
        device->matches[device->nmatches - 1] = libwacom_copy_match(&match);
        device->match = device->nmatches - 1;
+out:
        g_free(newmatch);
+       g_free(match.name);
 }
 
 int libwacom_get_vendor_id(const WacomDevice *device)
-- 
2.4.1


------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to