Unverified Commit e7febea6 authored by Shawn Webb's avatar Shawn Webb
Browse files

Free the escaped string on sbuf failure



When sbuf_printf fails, we should free the string returned from
curl_easy_escape to avoid a memory leak.
Signed-off-by: Shawn Webb's avatarShawn Webb <shawn.webb@hardenedbsd.org>
parent 6a368c0a
...@@ -312,6 +312,7 @@ msg_to_str(pushover_ctx_t *ctx, pushover_message_t *msg, CURL *curl) ...@@ -312,6 +312,7 @@ msg_to_str(pushover_ctx_t *ctx, pushover_message_t *msg, CURL *curl)
goto end; goto end;
} }
if (sbuf_printf(sb, "&device=%s", p)) { if (sbuf_printf(sb, "&device=%s", p)) {
curl_free(p);
goto end; goto end;
} }
curl_free(p); curl_free(p);
...@@ -322,6 +323,7 @@ msg_to_str(pushover_ctx_t *ctx, pushover_message_t *msg, CURL *curl) ...@@ -322,6 +323,7 @@ msg_to_str(pushover_ctx_t *ctx, pushover_message_t *msg, CURL *curl)
goto end; goto end;
} }
if (sbuf_printf(sb, "&message=%s", p)) { if (sbuf_printf(sb, "&message=%s", p)) {
curl_free(p);
goto end; goto end;
} }
curl_free(p); curl_free(p);
...@@ -332,6 +334,7 @@ msg_to_str(pushover_ctx_t *ctx, pushover_message_t *msg, CURL *curl) ...@@ -332,6 +334,7 @@ msg_to_str(pushover_ctx_t *ctx, pushover_message_t *msg, CURL *curl)
goto end; goto end;
} }
if (sbuf_printf(sb, "&title=%s", p)) { if (sbuf_printf(sb, "&title=%s", p)) {
curl_free(p);
goto end; goto end;
} }
curl_free(p); curl_free(p);
...@@ -342,6 +345,7 @@ msg_to_str(pushover_ctx_t *ctx, pushover_message_t *msg, CURL *curl) ...@@ -342,6 +345,7 @@ msg_to_str(pushover_ctx_t *ctx, pushover_message_t *msg, CURL *curl)
goto end; goto end;
} }
if (sbuf_printf(sb, "&token=%s", p)) { if (sbuf_printf(sb, "&token=%s", p)) {
curl_free(p);
goto end; goto end;
} }
curl_free(p); curl_free(p);
...@@ -352,6 +356,7 @@ msg_to_str(pushover_ctx_t *ctx, pushover_message_t *msg, CURL *curl) ...@@ -352,6 +356,7 @@ msg_to_str(pushover_ctx_t *ctx, pushover_message_t *msg, CURL *curl)
goto end; goto end;
} }
if (sbuf_printf(sb, "&user=%s", p)) { if (sbuf_printf(sb, "&user=%s", p)) {
curl_free(p);
goto end; goto end;
} }
curl_free(p); curl_free(p);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment