kore

An easy to use, scalable and secure web application framework for writing web APIs in C.
Commits | Files | Refs | README | LICENSE | git clone https://git.kore.io/kore.git

commit 4fc434e9096bcf8afdf0d5b66a095afd7ee0937b
parent 05156c9a3a41d67b6f32b1a7855c0cec0c9bed7b
Author: Joris Vink <joris@coders.se>
Date:   Wed,  1 May 2013 01:23:46 +0200

make sure method, path and host are free'd in case of failure.

Diffstat:
src/spdy.c | 12+++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/spdy.c b/src/spdy.c @@ -157,11 +157,21 @@ spdy_ctrl_frame_syn_stream(struct netbuf *nb) s->header_pairs = net_read32(s->header_block); kore_log("got %d headers", s->header_pairs); + path = NULL; + host = NULL; + method = NULL; + #define GET_HEADER(n, r) \ - if (!spdy_stream_get_header(s, n, r)) { \ + if (!spdy_stream_get_header(s, n, r)) { \ free(s->header_block); \ free(s); \ kore_log("no such header: %s", n); \ + if (path != NULL) \ + free(path); \ + if (host != NULL) \ + free(host); \ + if (method != NULL) \ + free(method); \ return (KORE_RESULT_ERROR); \ }