Fix CID 11019: Resource leak

https://fedorahosted.org/freeipa/ticket/2037
This commit is contained in:
Simo Sorce 2011-11-03 13:21:59 -04:00
parent 8276d5d55f
commit 299c91df92

View File

@ -263,6 +263,13 @@ int ipadb_get_connection(struct ipadb_context *ipactx)
done:
ldap_msgfree(res);
ldap_value_free_len(vals);
for (i = 0; i < c && cvals[i]; i++) {
free(cvals[i]);
}
free(cvals);
if (ret) {
if (ipactx->lcontext) {
ldap_unbind_ext_s(ipactx->lcontext, NULL, NULL);
@ -274,12 +281,6 @@ done:
return EIO;
}
ldap_value_free_len(vals);
for (i = 0; i < c; i++) {
free(cvals[i]);
}
free(cvals);
return 0;
}