commit 1d5efc034952f6db8fcec46987dcabe86fbd5245
parent 9e846e522b3aa03277ab19244d40b2dd1109f7b3
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date: Fri, 25 Dec 2020 19:21:24 +0300
Examples: fixed logic error
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/examples/websocket_threaded_example.c b/src/examples/websocket_threaded_example.c
@@ -714,16 +714,16 @@ run_usock (void *cls)
size = sprintf (client, "User#%d: ", (int)ws->sock);
size += got;
text = malloc (size);
- if (NULL != buf)
+ if (NULL != text)
{
sprintf (text, "%s%s", client, msg);
sent = ws_send_frame (ws->sock, text, size);
+ free (text);
}
else
{
sent = -1;
}
- free (text);
free (msg);
if (-1 == sent)
{