Author: vlendec Date: 2006-07-17 15:00:49 +0000 (Mon, 17 Jul 2006) New Revision: 17089
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=17089 Log: Fix a possible null dereference and some memleaks. Jerry, please check. Thanks, Volker Modified: branches/SAMBA_3_0/source/libads/cldap.c branches/SAMBA_3_0/source/libads/ldap.c Changeset: Modified: branches/SAMBA_3_0/source/libads/cldap.c =================================================================== --- branches/SAMBA_3_0/source/libads/cldap.c 2006-07-17 11:17:32 UTC (rev 17088) +++ branches/SAMBA_3_0/source/libads/cldap.c 2006-07-17 15:00:49 UTC (rev 17089) @@ -191,6 +191,11 @@ char *p; blob = data_blob(NULL, 8192); + if (blob.data == NULL) { + DEBUG(1, ("data_blob failed\n")); + errno = ENOMEM; + return -1; + } /* Setup timeout */ gotalarm = 0; @@ -206,6 +211,7 @@ if (ret <= 0) { DEBUG(1,("no reply received to cldap netlogon\n")); + data_blob_free(&blob); return -1; } blob.length = ret; @@ -227,6 +233,7 @@ asn1_end_tag(&data); if (data.has_error) { + data_blob_free(&blob); asn1_free(&data); DEBUG(1,("Failed to parse cldap reply\n")); return -1; Modified: branches/SAMBA_3_0/source/libads/ldap.c =================================================================== --- branches/SAMBA_3_0/source/libads/ldap.c 2006-07-17 11:17:32 UTC (rev 17088) +++ branches/SAMBA_3_0/source/libads/ldap.c 2006-07-17 15:00:49 UTC (rev 17089) @@ -134,6 +134,7 @@ if ( !ads_cldap_netlogon( srv, ads->server.realm, &cldap_reply ) ) { DEBUG(3,("ads_try_connect: CLDAP request %s failed.\n", srv)); + SAFE_FREE( srv ); return False; }