FreeRDP/FreeRDP — Issue #477: xfreerdp: free(): invalid pointer credssp_client_authenticate
Author: NiKiZe
Created: 2012-02-29 20:14:30+00:00
State: open

with commit 506cca7abbb28c6afb7c793c27ca20d6670f6d28

*** glibc detected *** client/X11/xfreerdp: free(): invalid pointer: 0x000000000138f130 ***
======= Backtrace: =========
/lib64/libc.so.6(+0x72f66)[0x7f025ac8cf66]
/lib64/libc.so.6(cfree+0x6c)[0x7f025ac91cfc]
/home/nixze/FreeRDP-1.0/libfreerdp-utils/libfreerdp-utils.so.1.0(xfree+0x1f)[0x7f025c96d1d3]
/home/nixze/FreeRDP-1.0/libfreerdp-auth/libfreerdp-auth.so.1.0(sspi_SecBufferFree+0x26)[0x7f025bbcf20e]
/home/nixze/FreeRDP-1.0/libfreerdp-auth/libfreerdp-auth.so.1.0(credssp_client_authenticate+0x7ba)[0x7f025bbd09d6]
/home/nixze/FreeRDP-1.0/libfreerdp-auth/libfreerdp-auth.so.1.0(credssp_authenticate+0x31)[0x7f025bbd0a50]
/home/nixze/FreeRDP-1.0/libfreerdp-core/libfreerdp-core.so.1.0(transport_connect_nla+0xe1)[0x7f025d3ff738]
/home/nixze/FreeRDP-1.0/libfreerdp-core/libfreerdp-core.so.1.0(rdp_client_connect+0x17e)[0x7f025d3f7e8a]
/home/nixze/FreeRDP-1.0/libfreerdp-core/libfreerdp-core.so.1.0(freerdp_connect+0x85)[0x7f025d3efd95]
client/X11/xfreerdp(xfreerdp_run+0x74)[0x41712d]
client/X11/xfreerdp(thread_func+0x23)[0x41751d]
/lib64/libpthread.so.0(+0x6c1a)[0x7f025af86c1a]
/lib64/libc.so.6(clone+0x6d)[0x7f025acec28d]

running in gdb:
(gdb) where
#0 0x00007ffff4bee455 in raise () from /lib64/libc.so.6
#1 0x00007ffff4bef870 in abort () from /lib64/libc.so.6
#2 0x00007ffff4c2999b in ?? () from /lib64/libc.so.6
#3 0x00007ffff4c2ef66 in ?? () from /lib64/libc.so.6
#4 0x00007ffff4c33cfc in free () from /lib64/libc.so.6
#5 0x00007ffff690f1d3 in xfree (ptr=0x70a130) at /home/nixze/FreeRDP-1.0/libfreerdp-utils/memory.c:101
#6 0x00007ffff5b7120e in sspi_SecBufferFree (sec_buffer=0x709058) at /home/nixze/FreeRDP-1.0/libfreerdp-auth/sspi.c:197

#7 0x00007ffff5b729d6 in credssp_client_authenticate (credssp=0x709020) at /home/nixze/FreeRDP-1.0/libfreerdp-auth/credssp.c:391

#8 0x00007ffff5b72a50 in credssp_authenticate (credssp=0x709020) at /home/nixze/FreeRDP-1.0/libfreerdp-auth/credssp.c:422
#9 0x00007ffff73a1738 in transport_connect_nla (transport=0x69f240) at /home/nixze/FreeRDP-1.0/libfreerdp-core/transport.c:126
#10 0x00007ffff7399e8a in rdp_client_connect (rdp=0x69d140) at /home/nixze/FreeRDP-1.0/libfreerdp-core/connection.c:91
#11 0x00007ffff7391d95 in freerdp_connect (instance=0x69cfb0) at /home/nixze/FreeRDP-1.0/libfreerdp-core/freerdp.c:59
#12 0x000000000041712d in xfreerdp_run (instance=0x69cfb0) at /home/nixze/FreeRDP-1.0/client/X11/xfreerdp.c:1046
#13 0x000000000041751d in thread_func (param=0x6c1a00) at /home/nixze/FreeRDP-1.0/client/X11/xfreerdp.c:1157
#14 0x00007ffff4f28c1a in start_thread () from /lib64/libpthread.so.0
#15 0x00007ffff4c8e28d in clone () from /lib64/libc.so.6

tried to check for null but it did not work, commented out sspi_SecBufferFree(&credssp->negoToken);
and now it "works",

I noted several returs.. and that witout freeing possibly initialized structures, shuldn't they be freed on those returns as well?