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

This commit is contained in:
Joris Vink 2013-05-01 01:23:46 +02:00
parent 05156c9a3a
commit 4fc434e909
1 changed files with 11 additions and 1 deletions

View File

@ -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); \
}