diff options
author | Endi S. Dewata <edewata@redhat.com> | 2010-07-29 15:14:53 -0500 |
---|---|---|
committer | Noriko Hosoi <nhosoi@redhat.com> | 2010-08-19 14:23:54 -0700 |
commit | f847a62bcc808cd2c7cd77196bb4cdc23bad0a68 (patch) | |
tree | 6b55c194aa0eb98566edf187aa1740dd35a39e71 | |
parent | ea689555775f4c4219d5411a6b447ff57f074446 (diff) | |
download | ds-f847a62bcc808cd2c7cd77196bb4cdc23bad0a68.tar.gz ds-f847a62bcc808cd2c7cd77196bb4cdc23bad0a68.tar.xz ds-f847a62bcc808cd2c7cd77196bb4cdc23bad0a68.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 12001.
description: The slapi_vattrspi_register_internal() has been modified to remove unnecessary NULL checking.
-rw-r--r-- | ldap/servers/slapd/vattr.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/ldap/servers/slapd/vattr.c b/ldap/servers/slapd/vattr.c index 1694846f..025c71e0 100644 --- a/ldap/servers/slapd/vattr.c +++ b/ldap/servers/slapd/vattr.c @@ -1570,31 +1570,24 @@ int slapi_vattrspi_register_internal(vattr_sp_handle **h, vattr_get_fn_type get_ vattr_sp_handle *return_to_caller = NULL; vattr_sp_handle *list_handle = NULL; vattr_sp *new_sp = NULL; + /* Make a service provider handle */ new_sp = (vattr_sp*)slapi_ch_calloc(1,sizeof(vattr_sp)); - if (NULL == new_sp) { - slapd_nasty(sourcefile,7,0); - return ENOMEM; - } - return_to_caller = (vattr_sp_handle*)slapi_ch_calloc(1,sizeof(vattr_sp_handle)); - if (NULL == return_to_caller) { - slapd_nasty(sourcefile,8,0); - return ENOMEM; - } new_sp->sp_get_fn = get_fn; new_sp->sp_get_ex_fn = get_ex_fn; new_sp->sp_compare_fn = compare_fn; new_sp->sp_types_fn = types_fn; + + return_to_caller = (vattr_sp_handle*)slapi_ch_calloc(1,sizeof(vattr_sp_handle)); return_to_caller->sp = new_sp; + /* Add to the service provider list */ /* Make a handle for the list */ list_handle = (vattr_sp_handle*)slapi_ch_calloc(1, sizeof (vattr_sp_handle)); - if (NULL == list_handle) { - return ENOMEM; - } *list_handle = *return_to_caller; list_handle->next = vattr_sp_list; vattr_sp_list = list_handle; + /* Return the handle to the caller */ *h = return_to_caller; return 0; |