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 <[email protected]>
---
 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

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to