[Xcb] Memleak in xcb_auth.c

Andreas Fink andreas.fink85 at googlemail.com
Thu Oct 7 10:08:30 PDT 2010


Just used valgrind to debug my program and I crossed a memleak in libxcb. Problematic lines (I'm talking of the 1.7 release):
xcb_auth.c:302 if ((sockname = get_peer_sock_name(getpeername, fd)) == NULL) 
   - Here the variable sockname gets a value (at least on my machine) but the gotsockname variable will not be set to TRUE
xcb_auth.c:325 if (!gotsockname && (sockname = get_peer_sock_name(getsockname, fd)) == NULL)
   - Here the sockname variable gets a new value without free-ing the old pointer.

I did a free(sockname) right before line 325 and the memleak disappeared. However it probably is smarter to set gotsockname to
TRUE after the first call to get_peer_sock_name in line 302.

Regards
Andreas


More information about the Xcb mailing list