diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2018-09-30 14:35:15 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2018-09-30 14:42:51 -0700 |
commit | 777236e942ae85bcacfdc2e086944a42cfed5b45 (patch) | |
tree | f88e63762b7a5ee87c380cecc59dd7bf5cf3fad5 | |
parent | 4512f268c689db62b46c88e813935c66eda14742 (diff) |
If we can't find a colormap to replace, insert new one instead of leaking it
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@oracle.com>
-rw-r--r-- | src/util.c | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -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 */ |