httpc: fix some memory leaks in the error paths
This commit is contained in:
parent
dd06dde369
commit
7bf59f2fa4
1 changed files with 6 additions and 3 deletions
|
@ -526,6 +526,7 @@ http_client_send( http_client_t *hc, enum http_cmd cmd,
|
|||
if (hc->hc_shutdown) {
|
||||
if (header)
|
||||
http_arg_flush(header);
|
||||
free(wcmd);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
|
@ -535,7 +536,10 @@ http_client_send( http_client_t *hc, enum http_cmd cmd,
|
|||
htsbuf_queue_init(&q, 0);
|
||||
s = http_cmd2str(cmd);
|
||||
if (s == NULL) {
|
||||
http_arg_flush(header);
|
||||
error:
|
||||
if (header)
|
||||
http_arg_flush(header);
|
||||
free(wcmd);
|
||||
return -EINVAL;
|
||||
}
|
||||
htsbuf_append(&q, s, strlen(s));
|
||||
|
@ -551,8 +555,7 @@ http_client_send( http_client_t *hc, enum http_cmd cmd,
|
|||
s = http_ver2str(hc->hc_version);
|
||||
if (s == NULL) {
|
||||
htsbuf_queue_flush(&q);
|
||||
http_arg_flush(header);
|
||||
return -EINVAL;
|
||||
goto error;
|
||||
}
|
||||
htsbuf_append(&q, s, strlen(s));
|
||||
htsbuf_append(&q, "\r\n", 2);
|
||||
|
|
Loading…
Add table
Reference in a new issue