From e81b8522d72c622658abca9faeb1e994cd9c155a Mon Sep 17 00:00:00 2001 From: sears Date: Mon, 25 Apr 2011 15:28:45 +0000 Subject: [PATCH] fix memory leaks git-svn-id: svn+ssh://svn.corp.yahoo.com/yahoo/yrl/labs/pnuts/code/logstore@2457 8dad8b1f-cf64-0410-95b6-bcf113ffbcfe --- bloomFilter.c | 1 + logstore.cpp | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/bloomFilter.c b/bloomFilter.c index c1b3d40..ac6e08f 100644 --- a/bloomFilter.c +++ b/bloomFilter.c @@ -68,6 +68,7 @@ bloom_filter_t * bloom_filter_create(uint64_t(*func_a)(const char*,int), } void bloom_filter_destroy(bloom_filter_t* bf) { free(bf->buckets); + free(bf->result_scratch_space); free(bf); } // XXX this uses %. It would be better if it used &, but that would potentially double the memory we use. #define a flag. diff --git a/logstore.cpp b/logstore.cpp index 128967b..51df3d9 100644 --- a/logstore.cpp +++ b/logstore.cpp @@ -145,8 +145,10 @@ void logtable::openTable(int xid, recordid rid) { template void logtable::logUpdate(datatuple * tup) { - LogEntry * e = stasis_log_write_update(log_file, 0, INVALID_PAGE, 0/*Page**/, 0/*op*/, tup->to_bytes(), tup->byte_length()); + byte * buf = tup->to_bytes(); + LogEntry * e = stasis_log_write_update(log_file, 0, INVALID_PAGE, 0/*Page**/, 0/*op*/, buf, tup->byte_length()); log_file->write_entry_done(log_file,e); + free(buf); } template @@ -165,6 +167,7 @@ void logtable::replayLog() { default: assert(e->type == UPDATELOG); abort(); } } + freeLogHandle(lh); recovering = false; printf("\nLog replay complete.\n");