浏览代码

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 年之前
父节点
当前提交
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;
 }