summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2013-05-09 11:21:40 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2013-05-09 11:48:33 +1000
commit6d26cb9b9f71bfec1c388a72dcbb09f09f31bd04 (patch)
tree10a0b9633704cdcc61e8754468843d425d4d5f16
parentdff311a44c13687c12e86d8233f15bb0f8868361 (diff)
downloadxf86-input-wacom-6d26cb9b9f71bfec1c388a72dcbb09f09f31bd04.tar.gz
Free input attribute's product
This is copied first by DuplicateInputAttributes, then asprintf makes another copy. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Ping Cheng <pinglinux@gmail.com>
-rw-r--r--src/wcmValidateDevice.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/wcmValidateDevice.c b/src/wcmValidateDevice.c
index af3b153..e62946e 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