Skip to content
  • Alan Coopersmith's avatar
    handle.c: avoid leaks when realloc() fails · 10eecbe8
    Alan Coopersmith authored
    Resolves issues reported by Oracle Parfait static analyzer:
    
    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/xmodm...
    10eecbe8