1
0
mirror of https://github.com/moparisthebest/curl synced 2024-08-13 17:03:50 -04:00

mqttd: fclose test file when done

Reported-by: Marc Hörsken
Reviewed-by: Jay Satiro
Bug: #6058
Closes #6189
This commit is contained in:
Daniel Stenberg 2020-11-09 08:49:59 +01:00
parent ec48bee3f8
commit 3c5c6e7477
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -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;
}