diff options
author | Volker Lendecke <vlendec@samba.org> | 2006-07-17 15:00:49 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 11:38:11 -0500 |
commit | 846e939260c30d902952d95413d9cc3d06a82173 (patch) | |
tree | 9f9f446e59988c568506c91e1bc082eea939e531 | |
parent | 9c160dd9a7c88afaac7570581062060271b6f757 (diff) | |
download | samba-846e939260c30d902952d95413d9cc3d06a82173.tar.gz samba-846e939260c30d902952d95413d9cc3d06a82173.tar.bz2 samba-846e939260c30d902952d95413d9cc3d06a82173.zip |
r17089: Fix a possible null dereference and some memleaks.
Jerry, please check.
Thanks,
Volker
(This used to be commit b87c4952216b6302b0e1f22689b5a36b6aa65349)
-rw-r--r-- | source3/libads/cldap.c | 7 | ||||
-rw-r--r-- | source3/libads/ldap.c | 1 |
2 files changed, 8 insertions, 0 deletions
diff --git a/source3/libads/cldap.c b/source3/libads/cldap.c index f67372805f..2e96270e90 100644 --- a/source3/libads/cldap.c +++ b/source3/libads/cldap.c @@ -191,6 +191,11 @@ static int recv_cldap_netlogon(int sock, struct cldap_netlogon_reply *reply) 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 @@ static int recv_cldap_netlogon(int sock, struct cldap_netlogon_reply *reply) 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 @@ static int recv_cldap_netlogon(int sock, struct cldap_netlogon_reply *reply) 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; diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c index a8ee770582..5d972b35fc 100644 --- a/source3/libads/ldap.c +++ b/source3/libads/ldap.c @@ -134,6 +134,7 @@ BOOL ads_try_connect(ADS_STRUCT *ads, const char *server ) 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; } |