Plug memory leak if ldap_get_option() fails with LDAP_NO_MEMORY.
This commit is contained in:
@@ -189,7 +189,7 @@ sudo_ldap_innetgr_base(LDAP *ld, const char *base,
|
|||||||
if (bv == NULL) {
|
if (bv == NULL) {
|
||||||
const int optrc = ldap_get_option(ld, LDAP_OPT_RESULT_CODE, &rc);
|
const int optrc = ldap_get_option(ld, LDAP_OPT_RESULT_CODE, &rc);
|
||||||
if (optrc != LDAP_OPT_SUCCESS || rc == LDAP_NO_MEMORY)
|
if (optrc != LDAP_OPT_SUCCESS || rc == LDAP_NO_MEMORY)
|
||||||
debug_return_int(-1);
|
goto done;
|
||||||
} else {
|
} else {
|
||||||
for (p = bv; *p != NULL && !ret; p++) {
|
for (p = bv; *p != NULL && !ret; p++) {
|
||||||
char *val = (*p)->bv_val;
|
char *val = (*p)->bv_val;
|
||||||
@@ -208,7 +208,7 @@ sudo_ldap_innetgr_base(LDAP *ld, const char *base,
|
|||||||
if (bv == NULL) {
|
if (bv == NULL) {
|
||||||
const int optrc = ldap_get_option(ld, LDAP_OPT_RESULT_CODE, &rc);
|
const int optrc = ldap_get_option(ld, LDAP_OPT_RESULT_CODE, &rc);
|
||||||
if (optrc != LDAP_OPT_SUCCESS || rc == LDAP_NO_MEMORY)
|
if (optrc != LDAP_OPT_SUCCESS || rc == LDAP_NO_MEMORY)
|
||||||
debug_return_int(-1);
|
goto done;
|
||||||
} else {
|
} else {
|
||||||
for (p = bv; *p != NULL && !ret; p++) {
|
for (p = bv; *p != NULL && !ret; p++) {
|
||||||
const char *val = (*p)->bv_val;
|
const char *val = (*p)->bv_val;
|
||||||
|
Reference in New Issue
Block a user