فهرست منبع

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 11997.
description: The str2entry_fast() has been modified to release attributedeletioncsn before returning.
Endi S. Dewata 15 سال پیش
والد
کامیت
bed415b12d
1فایلهای تغییر یافته به همراه11 افزوده شده و 5 حذف شده
  1. 11 5
      ldap/servers/slapd/entry.c

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

@@ -285,7 +285,8 @@ str2entry_fast( 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);
-						return NULL;
+						e = NULL;
+						goto done;
 					}
 				}
 				/* normdn is consumed in e */
@@ -307,7 +308,8 @@ str2entry_fast( 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);
-							return NULL;
+							e = NULL;
+							goto done;
 						}
 					}
 					/* normdn is just referred in slapi_entry_set_rdn. */
@@ -343,7 +345,8 @@ str2entry_fast( 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);
-				return NULL;
+				e = NULL;
+				goto done;
 			}
 			/* normdn is consumed in e */
 			slapi_entry_set_dn(e, normdn);
@@ -441,7 +444,8 @@ str2entry_fast( 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);
-						return NULL;
+						e = NULL;
+						goto done;
 					}
 				}
 				if (flags & SLAPI_STR2ENTRY_USE_OBSOLETE_DNFORMAT) {
@@ -536,9 +540,11 @@ str2entry_fast( const char *rawdn, char *s, int flags, int read_stateinfo )
 			LDAPDebug( LDAP_DEBUG_ANY, "str2entry_fast: entry has no dn\n",
 									   0, 0, 0 );
 		slapi_entry_free( e );
-		return( NULL );
+		e = NULL;
 	}
 
+done:
+	csn_free(&attributedeletioncsn);
 	LDAPDebug( LDAP_DEBUG_TRACE, "<= str2entry_fast 0x%x\n",
 		e, 0, 0 );
 	return( e );