Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

tcdb: fix a leak that impacts INCR[BY] / DECR[BY] commands

  • Loading branch information...
commit 15c59c65630244e0cbd1b790f0d5fb714b8bf532 1 parent 0cebb6c
@deltheil deltheil authored
Showing with 2 additions and 1 deletion.
  1. +2 −1  tcdb.c
View
3  tcdb.c
@@ -596,7 +596,7 @@ static int64_t rk_tcdb_add_int(rk_tcdb_t *db, const char *kbuf, int ksiz, int64_
int vsiz;
char buf[32];
int siz;
- const char *vbuf = tchdbget(db->str, kbuf, ksiz, &vsiz);
+ char *vbuf = tchdbget(db->str, kbuf, ksiz, &vsiz);
if (vbuf == NULL) {
if (tchdbecode(db->str) == TCENOREC) rv = num;
else err = true;
@@ -604,6 +604,7 @@ static int64_t rk_tcdb_add_int(rk_tcdb_t *db, const char *kbuf, int ksiz, int64_
else {
if (tcstrisnum(vbuf)) rv = tcatoi(vbuf) + num;
else err = true;
+ free(vbuf);
}
if (!err) {
siz = sprintf(buf, "%lld", (long long) rv);
Please sign in to comment.
Something went wrong with that request. Please try again.