Explorar o código

Bug 690584 - #10654 #10653 str2entry_dupcheck - fix coverity resource leak issues

https://bugzilla.redhat.com/show_bug.cgi?id=690584
Resolves: bug 690584
Bug Description: #10654 #10653 str2entry_dupcheck - fix coverity resource leak issues
Reviewed by: nkinder (Thanks!)
Branch: master
Fix Description: make sure to free maxcsn and attributedeletioncsn before they go
out of scope
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: no
Rich Megginson %!s(int64=14) %!d(string=hai) anos
pai
achega
51bf2d258d
Modificáronse 1 ficheiros con 4 adicións e 0 borrados
  1. 4 0
      ldap/servers/slapd/entry.c

+ 4 - 0
ldap/servers/slapd/entry.c

@@ -809,6 +809,7 @@ str2entry_dupcheck( const char *rawdn, char *s, int flags, int read_stateinfo )
 					slapi_entry_free( e );
 					if (freeval) slapi_ch_free_string(&bvvalue.bv_val);
 					csn_free(&attributedeletioncsn);
+					csn_free(&maxcsn);
 					return NULL;
 				}
 				/* normdn is consumed in e */
@@ -826,6 +827,7 @@ str2entry_dupcheck( const char *rawdn, char *s, int flags, int read_stateinfo )
 						slapi_entry_free( e );
 						if (freeval) slapi_ch_free_string(&bvvalue.bv_val);
 						csn_free(&attributedeletioncsn);
+						csn_free(&maxcsn);
 						return NULL;
 					}
 					/* normdn is just referred in slapi_entry_set_rdn. */
@@ -879,6 +881,7 @@ str2entry_dupcheck( const char *rawdn, char *s, int flags, int read_stateinfo )
 		if ( (flags & SLAPI_STR2ENTRY_NO_ENTRYDN) &&
 		     strcasecmp( type, "entrydn" ) == 0 ) {
 			if (freeval) slapi_ch_free_string(&bvvalue.bv_val);
+			csn_free(&attributedeletioncsn);
 			continue;
 		}
 
@@ -939,6 +942,7 @@ str2entry_dupcheck( const char *rawdn, char *s, int flags, int read_stateinfo )
 						/* Something very bad happened */
 						if (freeval) slapi_ch_free_string(&bvvalue.bv_val);
 						csn_free(&attributedeletioncsn);
+						csn_free(&maxcsn);
 						return NULL;
 					}
 					for ( i = 0; i < nattrs; i++ )