diff options
author | Endi S. Dewata <edewata@redhat.com> | 2010-07-29 01:34:14 -0500 |
---|---|---|
committer | Noriko Hosoi <nhosoi@redhat.com> | 2010-08-19 14:22:35 -0700 |
commit | ec5a296da501600ec35c3a9d6284b3d3c3e4346a (patch) | |
tree | 1465ad8a842040fb8a71be777f56a77ca1fac0d7 /ldap | |
parent | f27d4bbac4c13e21dfa62d35edd5af17dcee8c57 (diff) | |
download | ds-ec5a296da501600ec35c3a9d6284b3d3c3e4346a.tar.gz ds-ec5a296da501600ec35c3a9d6284b3d3c3e4346a.tar.xz ds-ec5a296da501600ec35c3a9d6284b3d3c3e4346a.zip |
Bug 619122 - fix coverify Defect Type: Resource leaks issues CID 11975 - 12053
https://bugzilla.redhat.com/show_bug.cgi?id=619122
Resolves: bug 619122
Bug description: fix coverify Defect Type: Resource leaks issues CID 11994.
description: The acl__malloc_aclpb() has been modified to release resources when an error occurs.
Diffstat (limited to 'ldap')
-rw-r--r-- | ldap/servers/plugins/acl/acl_ext.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/ldap/servers/plugins/acl/acl_ext.c b/ldap/servers/plugins/acl/acl_ext.c index fbe469fa..61d8dd11 100644 --- a/ldap/servers/plugins/acl/acl_ext.c +++ b/ldap/servers/plugins/acl/acl_ext.c @@ -567,33 +567,33 @@ acl__malloc_aclpb ( ) if ((aclpb->aclpb_proplist = PListNew(NULL)) == NULL) { slapi_log_error (SLAPI_LOG_FATAL, plugin_name, "Unable to allocate the aclprop PList\n"); - return NULL; + goto error; } if (PListInitProp(aclpb->aclpb_proplist, 0, DS_PROP_ACLPB, aclpb, 0) < 0) { slapi_log_error(SLAPI_LOG_FATAL, plugin_name, "Unable to set the ACL PBLOCK in the Plist\n"); - return NULL; + goto error; } if (PListInitProp(aclpb->aclpb_proplist, 0, DS_ATTR_USERDN, aclpb, 0) < 0) { slapi_log_error(SLAPI_LOG_FATAL, plugin_name, "Unable to set the USER DN in the Plist\n"); - return NULL; + goto error; } if (PListInitProp(aclpb->aclpb_proplist, 0, DS_ATTR_AUTHTYPE, aclpb, 0) < 0) { slapi_log_error(SLAPI_LOG_FATAL, plugin_name, "Unable to set the AUTH TYPE in the Plist\n"); - return NULL; + goto error; } if (PListInitProp(aclpb->aclpb_proplist, 0, DS_ATTR_ENTRY, aclpb, 0) < 0) { slapi_log_error(SLAPI_LOG_FATAL, plugin_name, "Unable to set the ENTRY TYPE in the Plist\n"); - return NULL; + goto error; } if (PListInitProp(aclpb->aclpb_proplist, 0, DS_ATTR_SSF, aclpb, 0) < 0) { slapi_log_error(SLAPI_LOG_FATAL, plugin_name, "Unable to set the SSF in the Plist\n"); - return NULL; + goto error; } /* @@ -608,7 +608,7 @@ acl__malloc_aclpb ( ) if (aclpb->aclpb_acleval == NULL) { slapi_log_error(SLAPI_LOG_FATAL, plugin_name, "Unable to allocate the acleval block\n"); - return NULL; + goto error; } /* * This is a libaccess routine. @@ -648,6 +648,12 @@ acl__malloc_aclpb ( ) return aclpb; +error: + if (aclpb->aclpb_acleval) ACL_EvalDestroy(NULL, NULL, aclpb->aclpb_acleval); + if (aclpb->aclpb_proplist) PListDestroy(aclpb->aclpb_proplist); + slapi_ch_free((void**)&aclpb); + + return NULL; } /* Initializes the aclpb */ |