diff options
author | Simon Thum <simon.thum@gmx.de> | 2016-04-05 14:29:47 +0200 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2016-04-22 14:32:24 +1000 |
commit | c8e5fc30575a309c25970fc68b9184c07bb74df4 (patch) | |
tree | 5e1c2823fe56d97e7d402a7b6f3ba13ec24deef5 /dix | |
parent | f641ae412287ecb7a3437987e2ba1646a8443aa4 (diff) |
dix/ptraccel: Fix memory leak in InitPredictableAccelerationScheme
This was quite unlikely except in situations where a proper startup
would have been impossible anyway, but since automated checks don't
grade likelyhood just fix it.
Detected by Jeremy Huddleston's clang checks.
Signed-off-by: Simon Thum <simon.thum@gmx.de>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'dix')
-rw-r--r-- | dix/ptrveloc.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/dix/ptrveloc.c b/dix/ptrveloc.c index e75300a17..050c12a0c 100644 --- a/dix/ptrveloc.c +++ b/dix/ptrveloc.c @@ -134,13 +134,19 @@ InitPredictableAccelerationScheme(DeviceIntPtr dev, scheme = *protoScheme; vel = calloc(1, sizeof(DeviceVelocityRec)); schemeData = calloc(1, sizeof(PredictableAccelSchemeRec)); - if (!vel || !schemeData) + if (!vel || !schemeData) { + free(vel); + free(schemeData); return FALSE; + } InitVelocityData(vel); schemeData->vel = vel; scheme.accelData = schemeData; - if (!InitializePredictableAccelerationProperties(dev, vel, schemeData)) + if (!InitializePredictableAccelerationProperties(dev, vel, schemeData)) { + free(vel); + free(schemeData); return FALSE; + } /* all fine, assign scheme to device */ dev->valuator->accelScheme = scheme; return TRUE; |