Przeglądaj źródła

Bug 690584 - #10655 acllas__handle_group_entry - fix coverity resource leak issues

https://bugzilla.redhat.com/show_bug.cgi?id=690584
Resolves: bug 690584
Bug Description: #10655 acllas__handle_group_entry - fix coverity resource leak issue
Reviewed by: nkinder (Thanks!)
Branch: master
Fix Description: Make sure n_dn is freed before returning.
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: no
Rich Megginson 14 lat temu
rodzic
commit
f25fef365d
1 zmienionych plików z 3 dodań i 1 usunięć
  1. 3 1
      ldap/servers/plugins/acl/acllas.c

+ 3 - 1
ldap/servers/plugins/acl/acllas.c

@@ -2376,7 +2376,7 @@ acllas__handle_group_entry (Slapi_Entry* e, void *callback_data)
 {
 {
 	struct eval_info	*info;
 	struct eval_info	*info;
  	Slapi_Attr		*currAttr, *nextAttr;
  	Slapi_Attr		*currAttr, *nextAttr;
-	char			*n_dn, *attrType;
+	char			*n_dn = NULL, *attrType;
 	int				n;
 	int				n;
 	int				i;
 	int				i;
 
 
@@ -2415,6 +2415,7 @@ acllas__handle_group_entry (Slapi_Entry* e, void *callback_data)
 				if (n < 0) {
 				if (n < 0) {
 					slapi_log_error( SLAPI_LOG_FATAL, plugin_name,
 					slapi_log_error( SLAPI_LOG_FATAL, plugin_name,
 						  "acllas__handle_group_entry: last member index lu_idx is overflown:%d: Too many group ACL members\n", n);
 						  "acllas__handle_group_entry: last member index lu_idx is overflown:%d: Too many group ACL members\n", n);
+					slapi_ch_free_string(&n_dn);
 					return 0;
 					return 0;
 				}
 				}
 				if (!(n % ACLLAS_MAX_GRP_MEMBER)) {
 				if (!(n % ACLLAS_MAX_GRP_MEMBER)) {
@@ -2428,6 +2429,7 @@ acllas__handle_group_entry (Slapi_Entry* e, void *callback_data)
 										 "acllas__handle_group_entry: out of memory - could not allocate space for %d group members\n",
 										 "acllas__handle_group_entry: out of memory - could not allocate space for %d group members\n",
 										 n + ACLLAS_MAX_GRP_MEMBER );
 										 n + ACLLAS_MAX_GRP_MEMBER );
 						info->memberInfo = orig_memberInfo;
 						info->memberInfo = orig_memberInfo;
+						slapi_ch_free_string(&n_dn);
 						return 0;
 						return 0;
 					}
 					}
 				}
 				}