Преглед на файлове

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 11995.
description: The str2entry_dupcheck() has been modified to release attributedeletioncsn properly.
Endi S. Dewata преди 15 години
родител
ревизия
a3a4387f39
променени са 1 файла, в които са добавени 11 реда и са изтрити 0 реда
  1. 11 0
      ldap/servers/slapd/entry.c

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

@@ -789,6 +789,7 @@ str2entry_dupcheck( const char *rawdn, char *s, int flags, int read_stateinfo )
 				/* the memory below was not allocated by the slapi_ch_ functions */
 				if (retmalloc) slapi_ch_free_string(&valuecharptr);
 				if (freetype) slapi_ch_free_string(&type);
+				csn_free(&attributedeletioncsn);
 				continue;
 			}
 			/* Ignore CSNs */
@@ -805,6 +806,7 @@ str2entry_dupcheck( const char *rawdn, char *s, int flags, int read_stateinfo )
 					slapi_entry_free( e );
 					if (retmalloc) slapi_ch_free_string(&valuecharptr);
 					if (freetype) slapi_ch_free_string(&type);
+					csn_free(&attributedeletioncsn);
 					return NULL;
 				}
 				/* normdn is consumed in e */
@@ -822,6 +824,7 @@ str2entry_dupcheck( const char *rawdn, char *s, int flags, int read_stateinfo )
 						slapi_entry_free( e );
 						if (retmalloc) slapi_ch_free_string(&valuecharptr);
 						if (freetype) slapi_ch_free_string(&type);
+						csn_free(&attributedeletioncsn);
 						return NULL;
 					}
 					/* normdn is just referred in slapi_entry_set_rdn. */
@@ -843,6 +846,7 @@ str2entry_dupcheck( const char *rawdn, char *s, int flags, int read_stateinfo )
 				/* the memory below was not allocated by the slapi_ch_ functions */
 				if (retmalloc) slapi_ch_free_string(&valuecharptr);
 				if (freetype) slapi_ch_free_string(&type);
+				csn_free(&attributedeletioncsn);
 				continue;
 			}
 			normdn = slapi_create_dn_string("%s", valuecharptr);
@@ -859,6 +863,7 @@ str2entry_dupcheck( const char *rawdn, char *s, int flags, int read_stateinfo )
 			/* the memory below was not allocated by the slapi_ch_ functions */
 			if (retmalloc) slapi_ch_free_string(&valuecharptr);
 			if (freetype) slapi_ch_free_string(&type);
+			csn_free(&attributedeletioncsn);
 		    continue;
 		}
 
@@ -869,6 +874,7 @@ str2entry_dupcheck( const char *rawdn, char *s, int flags, int read_stateinfo )
 			/* the memory below was not allocated by the slapi_ch_ functions */
 			if (retmalloc) slapi_ch_free_string(&valuecharptr);
 			if (freetype) slapi_ch_free_string(&type);
+			csn_free(&attributedeletioncsn);
 		    continue;
 		}
 
@@ -886,6 +892,7 @@ str2entry_dupcheck( const char *rawdn, char *s, int flags, int read_stateinfo )
 			/* the memory below was not allocated by the slapi_ch_ functions */
 			if (retmalloc) slapi_ch_free_string(&valuecharptr);
 			if (freetype) slapi_ch_free_string(&type);
+			csn_free(&attributedeletioncsn);
 			continue;
 		}
 
@@ -929,6 +936,7 @@ str2entry_dupcheck( const char *rawdn, char *s, int flags, int read_stateinfo )
 						/* Something very bad happened */
 						if (retmalloc) slapi_ch_free_string(&valuecharptr);
 						if (freetype) slapi_ch_free_string(&type);
+						csn_free(&attributedeletioncsn);
 						return NULL;
 					}
 					for ( i = 0; i < nattrs; i++ )
@@ -1015,6 +1023,7 @@ str2entry_dupcheck( const char *rawdn, char *s, int flags, int read_stateinfo )
 					slapi_entry_free( e ); e = NULL;
 					if (retmalloc) slapi_ch_free_string(&valuecharptr);
 					if (freetype) slapi_ch_free_string(&type);
+					csn_free(&attributedeletioncsn);
 					goto free_and_return;
 				}
 			}
@@ -1123,12 +1132,14 @@ str2entry_dupcheck( const char *rawdn, char *s, int flags, int read_stateinfo )
 		else if (rc==LDAP_TYPE_OR_VALUE_EXISTS)
 		{
 		    sa->sa_numdups++;
+		    csn_free(&attributedeletioncsn);
 		}
 		else
 		{
 		    /* Failure adding to value tree */
 		    LDAPDebug( LDAP_DEBUG_ANY, "str2entry_dupcheck: unexpected failure %d constructing value tree\n", rc, 0, 0 );
 		    slapi_entry_free( e ); e = NULL;
+		    csn_free(&attributedeletioncsn);
 		    goto free_and_return;
 		}