summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2014-03-08 20:09:46 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2014-03-08 20:16:19 -0800
commitdde40e03c10808b964dc1d6a7eb48156dd5ce4a2 (patch)
tree6462bb0d97fec9b94da78f5d4233f04967d36f4c
parentd5447c0156f556114dbf97d6064c0c7b0fcd5f70 (diff)
XeviGetVisualInfo: Free & clear *evi_return, not evi_return pointer
evi_return is passed in as a pointer to a location into which XeviGetVisualInfo is expected to write a pointer to the memory it allocated for the returned structures. If we're failing and bailing out, we need to dispose of the pointer we set, not the one passed into us (which the caller may have put on the stack or allocated as part of a larger structure). Flagged by cppcheck 1.64: [lib/libXext/src/XEVI.c:182] -> [lib/libXext/src/XEVI.c:186]: (warning) Possible null pointer dereference: evi_return - otherwise it is redundant to check it against null. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--src/XEVI.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/XEVI.c b/src/XEVI.c
index 6d77fdf..c9b172c 100644
--- a/src/XEVI.c
+++ b/src/XEVI.c
@@ -183,8 +183,10 @@ Status XeviGetVisualInfo(
_XEatDataWords(dpy, rep.length);
UnlockDisplay(dpy);
SyncHandle();
- if (evi_return)
- Xfree(evi_return);
+ if (*evi_return) {
+ Xfree(*evi_return);
+ *evi_return = NULL;
+ }
if (temp_xInfo)
Xfree(temp_xInfo);
if (temp_conflict)