FIX: free the response string buffer only if it is not NULL.
@@ -2180,6 +2180,7 @@ static void process_mop_get_complete(conn *c)
} else { /* ENGINE_ENOMEM */
STATS_NOKEY(c, cmd_mop_get);
mc_engine.v1->map_elem_release(mc_engine.v0, c, elem_array, elem_count);
+ if (respbuf != NULL)
free(respbuf);
if (c->ewouldblock)
c->ewouldblock = false;
@@ -10014,6 +10015,7 @@ static void process_lop_get(conn *c, char *key, size_t nkey,
} else { /* ENGINE_ENOMEM */
STATS_NOKEY(c, cmd_lop_get);
mc_engine.v1->list_elem_release(mc_engine.v0, c, elem_array, elem_count);
+ if (respbuf != NULL)
free(respbuf);
if (c->ewouldblock)
c->ewouldblock = false;
@@ -10432,6 +10434,7 @@ static void process_sop_get(conn *c, char *key, size_t nkey, uint32_t count,
} else { /* ENGINE_ENOMEM */
STATS_NOKEY(c, cmd_sop_get);
mc_engine.v1->set_elem_release(mc_engine.v0, c, elem_array, elem_count);
+ if (respbuf != NULL)
free(respbuf);
if (c->ewouldblock)
c->ewouldblock = false;
@@ -10830,6 +10833,7 @@ static void process_bop_get(conn *c, char *key, size_t nkey,
} else { /* ENGINE_ENOMEM */
STATS_NOKEY(c, cmd_bop_get);
mc_engine.v1->btree_elem_release(mc_engine.v0, c, elem_array, elem_count);
+ if (respbuf != NULL)
free(respbuf);
if (c->ewouldblock)
c->ewouldblock = false;
@@ -11041,6 +11045,7 @@ static void process_bop_pwg(conn *c, char *key, size_t nkey, const bkey_range *b
} else { /* ENGINE_ENOMEM */
STATS_NOKEY(c, cmd_bop_pwg);
mc_engine.v1->btree_elem_release(mc_engine.v0, c, elem_array, elem_count);
+ if (respbuf != NULL)
free(respbuf);
out_string(c, "SERVER_ERROR out of memory writing get response");
}
@@ -11163,6 +11168,7 @@ static void process_bop_gbp(conn *c, char *key, size_t nkey, ENGINE_BTREE_ORDER
} else { /* ENGINE_ENOMEM */
STATS_NOKEY(c, cmd_bop_gbp);
mc_engine.v1->btree_elem_release(mc_engine.v0, c, elem_array, elem_count);
+ if (respbuf != NULL)
free(respbuf);
out_string(c, "SERVER_ERROR out of memory writing get response");
}
