Parcourir la source

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 il y a 17 ans
Parent
commit
97f52d8106
1 fichiers modifiés avec 4 ajouts et 0 suppressions
  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;
 }