소스 검색

Bug 617630 - fix coverify Defect Type: Resource leaks issues CID 12052 - 12093

https://bugzilla.redhat.com/show_bug.cgi?id=617630
Resolves: bug 617630
Bug description: fix coverify Defect Type: Resource leaks issues CID 12084, 12085.
description: range_candidates() has been modified to release highs if an error occurs.
Endi S. Dewata 15 년 전
부모
커밋
50081f7a2f
1개의 변경된 파일6개의 추가작업 그리고 4개의 파일을 삭제
  1. 6 4
      ldap/servers/slapd/back-ldbm/filterindex.c

+ 6 - 4
ldap/servers/slapd/back-ldbm/filterindex.c

@@ -523,7 +523,7 @@ range_candidates(
     const Slapi_Attr *sattr
 )
 {
-    IDList *idl;
+    IDList *idl = NULL;
     struct berval *low = NULL, *high = NULL;
     struct berval **lows = NULL, **highs = NULL;
 
@@ -534,7 +534,8 @@ range_candidates(
         if (lows == NULL || *lows == NULL) {
             LDAPDebug( LDAP_DEBUG_TRACE,
                        "<= range_candidates ALLIDS (no keys)\n", 0, 0, 0 );
-            return( idl_allids( be ) );
+            idl = idl_allids( be );
+            goto done;
         }
         low = attr_value_lowest(lows, slapi_berval_reverse_cmp);
     }
@@ -544,8 +545,8 @@ range_candidates(
         if (highs == NULL || *highs == NULL) {
             LDAPDebug( LDAP_DEBUG_TRACE,
                        "<= range_candidates ALLIDS (no keys)\n", 0, 0, 0 );
-            if (lows) ber_bvecfree(lows);
-            return( idl_allids( be ) );
+            idl = idl_allids( be );
+            goto done;
         }
         high = attr_value_lowest(highs, slapi_berval_cmp);
     }
@@ -564,6 +565,7 @@ range_candidates(
                                low, high, 1, NULL, err);
     }
 
+done:
     if (lows) ber_bvecfree(lows);
     if (highs) ber_bvecfree(highs);