summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2018-09-30 14:35:15 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2018-09-30 14:42:51 -0700
commit777236e942ae85bcacfdc2e086944a42cfed5b45 (patch)
treef88e63762b7a5ee87c380cecc59dd7bf5cf3fad5
parent4512f268c689db62b46c88e813935c66eda14742 (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.c1
1 files changed, 1 insertions, 0 deletions
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 */