This is copied first by DuplicateInputAttributes, then asprintf makes
another copy.

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

diff --git a/src/wcmValidateDevice.c b/src/wcmValidateDevice.c
index af3b153..8b75006 100644
--- a/src/wcmValidateDevice.c
+++ b/src/wcmValidateDevice.c
@@ -437,10 +437,12 @@ static InputAttributes* 
wcmDuplicateAttributes(InputInfoPtr pInfo,
 {
        int rc;
        InputAttributes *attr;
+       char *product;
+
        attr = DuplicateInputAttributes(pInfo->attrs);
-       rc = asprintf(&attr->product, "%s %s", attr->product, type);
-       if (rc == -1)
-               attr->product = NULL;
+       rc = asprintf(&product, "%s %s", attr->product, type);
+       free(attr->product);
+       attr->product = (rc != -1) : product : NULL;
        return attr;
 }
 #endif
-- 
1.8.1.4


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and 
their applications. This 200-page book is written by three acclaimed 
leaders in the field. The early access version is available now. 
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to