[PATCH synaptics 1/2] Plug memory leak for option_string

Peter Hutterer peter.hutterer at who-t.net
Wed May 8 18:14:06 PDT 2013


xf86SetStrOption() returns a strdup'd string that must be freed after use.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 src/synaptics.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/synaptics.c b/src/synaptics.c
index 2de05d4..d4b21a9 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -513,12 +513,15 @@ set_softbutton_areas_option(InputInfoPtr pInfo)
     memcpy(pars->softbutton_areas[0], values, 4 * sizeof(int));
     memcpy(pars->softbutton_areas[1], values + 4, 4 * sizeof(int));
 
+    free(option_string);
+
     return;
 
  fail:
     xf86IDrvMsg(pInfo, X_ERROR,
                 "invalid SoftButtonAreas value '%s', keeping defaults\n",
                 option_string);
+    free(option_string);
 }
 
 static void
-- 
1.8.1.4



More information about the xorg-devel mailing list