summaryrefslogtreecommitdiff
path: root/src/plugins/relay/relay-websocket.c
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2022-12-18 14:10:10 +0100
committerSébastien Helleu <flashcode@flashtux.org>2022-12-18 14:28:58 +0100
commit40339b288ac37ace539d9091e8a2878540f49273 (patch)
tree5570b3a5a48e8a4cee4daaa36bc002d93a392084 /src/plugins/relay/relay-websocket.c
parenteb6cc0bc2afa96824667521d3405bd1c077a4690 (diff)
downloadweechat-40339b288ac37ace539d9091e8a2878540f49273.zip
api: return newly allocated string in functions string_tolower and string_toupper
Diffstat (limited to 'src/plugins/relay/relay-websocket.c')
-rw-r--r--src/plugins/relay/relay-websocket.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/plugins/relay/relay-websocket.c b/src/plugins/relay/relay-websocket.c
index 0f951448c..0fd57c023 100644
--- a/src/plugins/relay/relay-websocket.c
+++ b/src/plugins/relay/relay-websocket.c
@@ -72,7 +72,7 @@ void
relay_websocket_save_header (struct t_relay_client *client,
const char *message)
{
- char *pos, *name;
+ char *pos, *name, *name_lower;
const char *ptr_value;
/* ignore the "GET" request */
@@ -89,7 +89,12 @@ relay_websocket_save_header (struct t_relay_client *client,
name = weechat_strndup (message, pos - message);
if (!name)
return;
- weechat_string_tolower (name);
+ name_lower = weechat_string_tolower (name);
+ if (!name_lower)
+ {
+ free (name);
+ return;
+ }
/* get pointer on header value */
ptr_value = pos + 1;
@@ -99,9 +104,10 @@ relay_websocket_save_header (struct t_relay_client *client,
}
/* add header in the hashtable */
- weechat_hashtable_set (client->http_headers, name, ptr_value);
+ weechat_hashtable_set (client->http_headers, name_lower, ptr_value);
free (name);
+ free (name_lower);
}
/*