From ca988043685036f04507741a0892dfc9503190d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E5=8D=8E=E8=B6=85?= Date: Tue, 22 Mar 2016 10:24:17 +0800 Subject: [PATCH 1/2] Fix memroy leak for redis mset. --- src/proto/nc_redis.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/proto/nc_redis.c b/src/proto/nc_redis.c index b8ef86b3..196c5ffd 100644 --- a/src/proto/nc_redis.c +++ b/src/proto/nc_redis.c @@ -2293,6 +2293,7 @@ redis_copy_bulk(struct msg *dst, struct msg *src) struct mbuf *mbuf, *nbuf; uint8_t *p; uint32_t len = 0; + uint32_t mlen = 0; uint32_t bytes = 0; rstatus_t status; @@ -2328,13 +2329,16 @@ redis_copy_bulk(struct msg *dst, struct msg *src) /* copy len bytes to dst */ for (; mbuf;) { - if (mbuf_length(mbuf) <= len) { /* steal this buf from src to dst */ + mlen = mbuf_length(mbuf); + if (mlen <= len) { /* steal this buf from src to dst */ nbuf = STAILQ_NEXT(mbuf, next); mbuf_remove(&src->mhdr, mbuf); if (dst != NULL) { mbuf_insert(&dst->mhdr, mbuf); + } else { + mbuf_put(mbuf); } - len -= mbuf_length(mbuf); + len -= mlen; mbuf = nbuf; } else { /* split it */ if (dst != NULL) { From 00c2f8648c33162486833ef65b5a149b847f5d29 Mon Sep 17 00:00:00 2001 From: Huachao Huang Date: Tue, 22 Mar 2016 10:31:43 +0800 Subject: [PATCH 2/2] Fix travis. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 254d91a0..cb1b81bf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,3 @@ language: c script: bash ./travis.sh - +sudo: required