summaryrefslogtreecommitdiff
path: root/memcached.c
diff options
context:
space:
mode:
authordormando <dormando@rydia.net>2018-03-27 18:58:34 -0700
committerdormando <dormando@rydia.net>2018-03-27 19:16:18 -0700
commit95e6469bd2ceef92bcaaf140e2724fc73d556185 (patch)
tree553dd22dbb7d08ab10535e5800fc0e9d50d8c2b4 /memcached.c
parent583c8177ada2f6fcfa556140b94b019d31588e4a (diff)
downloadmemcached-95e6469bd2ceef92bcaaf140e2724fc73d556185.tar.gz
extstore: fix ref leak when using binprot GATK1.5.7
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.
Diffstat (limited to 'memcached.c')
-rw-r--r--memcached.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/memcached.c b/memcached.c
index 2807cf1..d6dd990 100644
--- a/memcached.c
+++ b/memcached.c
@@ -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;