Просмотр исходного кода

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 лет назад
Родитель
Сommit
97f52d8106
1 измененных файлов с 4 добавлено и 0 удалено
  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;
 }