Skip to content

Stop memory leaks

Alan Coopersmith requested to merge alanc/xmodmap:parfait into master

Resolves issues reported by Oracle Parfait static analyzer:

Error: Memory leak
   Memory leak [memory-leak] (CWE 401):
      Memory leak of pointer pointer allocated with XGetKeyboardMapping(...)
        at line 251 of app/xmodmap/exec.c in function 'PrintModifierMapping'.
          pointer allocated at line 222 with XGetKeyboardMapping(...)

Error: Memory leak
   Memory leak [memory-leak] (CWE 401):
      Memory leak of pointer kclist allocated with malloc((n * 1))
        at line 698 of app/xmodmap/handle.c in function 'do_remove'.
          kclist allocated at line 662 with malloc((n * 1))
          kclist leaks when num_kcs != 0 at line 676
              and (j + 1) >= num_kcs at line 687
              and (nc + num_kcs) > tot at line 691
              and (num_kcs - 1) < 0 at line 701.
   Memory leak [memory-leak] (CWE 401):
      Memory leak of pointer kclist allocated with malloc((n * 1))
        at line 711 of app/xmodmap/handle.c in function 'do_remove'.
          kclist allocated at line 662 with malloc((n * 1))
          kclist leaks when (i + 1) >= n at line 672.
Error: Memory leak
   Memory leak [memory-leak] (CWE 401):
      Memory leak of pointer kclist allocated with realloc(kclist, (tot * 1))
        at line 711 of app/xmodmap/handle.c in function 'do_remove'.
          kclist allocated at line 693 with realloc(kclist, (tot * 1))
          kclist leaks when (num_kcs - 1) < 0 at line 701
              and (i + 1) >= n at line 672.

Merge request reports

Loading