[PATCH app/twm 2/2] If we can't find a colormap to replace, insert new one instead of leaking it
Alan Coopersmith
alan.coopersmith at oracle.com
Sun Sep 30 21:44:36 UTC 2018
Found by Oracle's Parfait 2.2 static analyzer:
Error: Memory leak
Memory leak [memory-leak] (CWE 401):
Memory leak of pointer sc allocated with malloc(32)
at line 421 of src/util.c in function 'InsertRGBColormap'.
sc allocated at line 397 with malloc(32)
sc leaks when replace != 0 at line 405.
Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
src/util.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/util.c b/src/util.c
index e254cd5..acc8769 100644
--- a/src/util.c
+++ b/src/util.c
@@ -400,6 +400,7 @@ InsertRGBColormap (Atom a, XStandardColormap *maps, int nmaps, Bool replace)
ProgramName, (unsigned long)sizeof (StdCmap));
return;
}
+ replace = False;
}
if (replace) { /* just update contents */
--
2.15.2
More information about the xorg-devel
mailing list