Skip to content

Commit

Permalink
extstore: fix ref leak when using binprot GATK
Browse files Browse the repository at this point in the history
GATK returns a key but not the value. c->io_wraplist is only appended if the
value is to be returned, but c->item is skipped if it is an ITEM_HDR at all.

This now checks for the ITEM_HDR bit being set but also !value
which then reclaims the reference normally.

I knew doubling up the cleanup code made it a lot more complex, and hope to
flatten that to a single path. Also the TOUCH/GAT/GATK binprot code has no real
test coverage, nor mc-crusher entries. Should be worth fixing.
  • Loading branch information
dormando committed Mar 28, 2018
1 parent 583c817 commit 95e6469
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions memcached.c
Original file line number Diff line number Diff line change
Expand Up @@ -1686,10 +1686,11 @@ static void process_bin_get_or_touch(conn *c) {
c->write_and_go = conn_new_cmd;
/* Remember this command so we can garbage collect it later */
#ifdef EXTSTORE
if ((it->it_flags & ITEM_HDR) == 0) {
c->item = it;
} else {
if ((it->it_flags & ITEM_HDR) != 0 && should_return_value) {
// Only have extstore clean if header and returning value.
c->item = NULL;
} else {
c->item = it;
}
#else
c->item = it;
Expand Down

0 comments on commit 95e6469

Please sign in to comment.