From 4fde286233351edd27644a272b91db6355b37de0 Mon Sep 17 00:00:00 2001 From: Nicolas Favre-Felix Date: Sun, 5 Jun 2011 14:28:02 +0200 Subject: [PATCH] Fixed crash on pub/sub with custom formats. --- Makefile | 2 +- formats/custom-type.c | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 1978e09..fe49571 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ HTTP_PARSER_OBJS=http-parser/http_parser.o DEPS=$(FORMAT_OBJS) $(HIREDIS_OBJ) $(JANSSON_OBJ) $(HTTP_PARSER_OBJS) OBJS=webdis.o cmd.o worker.o slog.o server.o libb64/cencode.o acl.o md5/md5.o http.o client.o websocket.o pool.o conf.o $(DEPS) -CFLAGS=-O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser +CFLAGS=-O0 -ggdb -Wall -Wextra -I. -Ijansson/src -Ihttp-parser LDFLAGS=-levent -pthread all: $(OUT) Makefile diff --git a/formats/custom-type.c b/formats/custom-type.c index 96412bd..0267872 100644 --- a/formats/custom-type.c +++ b/formats/custom-type.c @@ -45,6 +45,9 @@ custom_type_reply(redisAsyncContext *c, void *r, void *privdata) { http_response_set_header(&resp, "Content-Length", "0"); http_response_set_keep_alive(&resp, cmd->keep_alive); http_response_write(&resp, cmd->fd); - cmd_free(cmd); + + if(!cmd_is_subscribe(cmd)) { + cmd_free(cmd); + } }