summaryrefslogtreecommitdiff
path: root/tests/server
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2020-11-09 08:49:59 +0100
committerDaniel Stenberg <daniel@haxx.se>2020-11-09 17:25:22 +0100
commit3c5c6e7477dacdd0efd76d5681e813b88c506abc (patch)
tree65b8a47e653bfdcb353e89f97ec565abcd98c6a6 /tests/server
parentec48bee3f8671593ae24fda742206ffeabc6c4c6 (diff)
downloadcurl-3c5c6e7477dacdd0efd76d5681e813b88c506abc.tar.gz
mqttd: fclose test file when done
Reported-by: Marc Hörsken Reviewed-by: Jay Satiro Bug: #6058 Closes #6189
Diffstat (limited to 'tests/server')
-rw-r--r--tests/server/mqttd.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/tests/server/mqttd.c b/tests/server/mqttd.c
index f0c768ed8..1f4344ac0 100644
--- a/tests/server/mqttd.c
+++ b/tests/server/mqttd.c
@@ -486,6 +486,7 @@ static curl_socket_t mqttit(curl_socket_t fd)
size_t bytes = 0; /* remaining length field size in bytes */
char client_id[MAX_CLIENT_ID_LENGTH];
long testno;
+ FILE *stream = NULL;
static const char protocol[7] = {
0x00, 0x04, /* protocol length */
@@ -550,7 +551,6 @@ static curl_socket_t mqttit(curl_socket_t fd)
}
}
else if(byte == MQTT_MSG_SUBSCRIBE) {
- FILE *stream;
int error;
char *data;
size_t datalen;
@@ -636,7 +636,10 @@ static curl_socket_t mqttit(curl_socket_t fd)
} while(1);
end:
- fclose(dump);
+ if(dump)
+ fclose(dump);
+ if(stream)
+ fclose(stream);
return CURL_SOCKET_BAD;
}