Pārlūkot izejas kodu

Resolves: #472999
Summary: vlv: memory leak
Description: if the addresses of the passed key and the returned key don't
match, the space for the returned key is allocated in libdb. Thus, we have to
release the returned key.

Noriko Hosoi 17 gadi atpakaļ
vecāks
revīzija
97f52d8106
1 mainītis faili ar 4 papildinājumiem un 0 dzēšanām
  1. 4 0
      ldap/servers/slapd/back-ldbm/vlv.c

+ 4 - 0
ldap/servers/slapd/back-ldbm/vlv.c

@@ -990,6 +990,10 @@ vlv_build_candidate_list_byvalue( struct vlvIndex* p, DBC *dbc, PRUint32 length,
         }
         LDAPDebug( LDAP_DEBUG_TRACE, "<= vlv_build_candidate_list_byvalue: Not Found. Index=%lu\n",si,0,0);
     }
+    if (key.data != typedown_value[0]->bv_val) { /* in case new key is set 
+                                                  in dbc->c_get(DB_SET_RANGE) */
+        slapi_ch_free(&(key.data));
+    }
     ber_bvecfree((struct berval**)typedown_value);
     return si;
 }