]> diplodocus.org Git - xorg-xinput/commit
Free strings allocated by GetAtomName instead of letting them leak
authorAlan Coopersmith <alan.coopersmith@oracle.com>
Fri, 1 Jun 2012 05:35:35 +0000 (22:35 -0700)
committerPeter Hutterer <peter.hutterer@who-t.net>
Fri, 1 Jun 2012 06:03:59 +0000 (16:03 +1000)
commit15f5811753c0be8d7e38c44dc1798740071ba5c1
tree851ef78056603b2773e4eadc7f836690674b0190
parent60fe84e83b14576fb70d79c5d39755a281906607
Free strings allocated by GetAtomName instead of letting them leak

Fixes errors reported by Parfait 0.5.0.1 bug checking tool:

Error: Memory leak (CWE 401)
   Memory leak of pointer '<unknown>' allocated with XGetAtomName(dpy, info->type)
        at line 122 of src/list.c in function 'print_info'.
          pointer allocated at line 84 with XGetAtomName(dpy, info->type).
          <unknown> leaks when i >= info->num_classes at line 88.
Error: Memory leak (CWE 401)
   Memory leak of pointer '<unknown>' allocated with XGetAtomName(dpy, a)
        at line 160 of src/property.c in function 'print_property'.
          pointer allocated at line 131 with XGetAtomName(dpy, a).
   Memory leak of pointer '<unknown>' allocated with XGetAtomName(dpy, act_type)
        at line 160 of src/property.c in function 'print_property'.
          pointer allocated at line 143 with XGetAtomName(dpy, act_type).
   Memory leak of pointer 'name' allocated with XGetAtomName(dpy, property)
        at line 160 of src/property.c in function 'print_property'.
          'name' allocated at line 61 with XGetAtomName(dpy, property).
Error: Memory leak (CWE 401)
   Memory leak of pointer '<unknown>' allocated with XGetAtomName(dpy, a)
        at line 521 of src/property.c in function 'print_property_xi2'.
          pointer allocated at line 491 with XGetAtomName(dpy, a).
   Memory leak of pointer '<unknown>' allocated with XGetAtomName(dpy, act_type)
        at line 521 of src/property.c in function 'print_property_xi2'.
          pointer allocated at line 504 with XGetAtomName(dpy, act_type).
   Memory leak of pointer 'name' allocated with XGetAtomName(dpy, property)
        at line 521 of src/property.c in function 'print_property_xi2'.
          'name' allocated at line 428 with XGetAtomName(dpy, property).

Confirmed with Solaris Studio runtime checker that "list-props" now has
fewer leaks than before and "watch-props" no longer leaks a string every
time a property changes.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
src/list.c
src/property.c