Reason: In lines 435 and 439, the function returns without calling closing
fptr which was opened at line 399.
Fix: I added fclose(fptr) statements before each of the returns.
Signed-off-by: Panagiotis Vasilikos <panagiotis.vasilikos@alexandra.dk>
Reason: There is no check that the mosquitto__malloc at line 162 was sucessfull.
This could result to a Null pointer dereference in the memcpy call at line 166.
Fix: I added the check.
Signed-off-by: Panagiotis Vasilikos <panagiotis.vasilikos@alexandra.dk>
Reason: In line 70, the memory allocation for the pointer reasons_codes may
result to a memory leak due to the many returns (e.g as the one in line 78)
occuring in the program's path until reaching the mosquitto__free at line 122.
Fix: I added a mosquitto__free(reason_codes) statement before each return
statement that could result to a memory leak
Signed-off-by: Panagiotis Vasilikos <panagiotis.vasilikos@alexandra.dk>
Reason: The memory allocated for the packet pointer at line 155 is not freed
before returning at line 188.
Fix: I inserted the mosquitto__free(packet) statement just before returning
at line 188.
Signed-off-by: Panagiotis Vasilikos <panagiotis.vasilikos@alexandra.dk>
Reason: In line 70, the memory allocation for the pointer reasons_codes may
result to a memory leak due to the many returns (e.g as the one in line 78)
occuring in the program's path until reaching the mosquitto__free at line 122.
Fix: I moved the memory allocation code block (lines 69-73) just before
the line 102. This is the first place the pointer reason_codes is used, while
the following mosquitto__free operators free the allocated memory correctly.
Signed-off-by: Panagiotis Vasilikos <panagiotis.vasilikos@alexandra.dk>
This allow more libraries to be linked when compiling the clients with a
static libmosquitto, as required for e.g. openssl on some systems.
Closes#1371. Thanks to Fabrice Fontaine.
Fix test on invalid null will topic value in connect packet
Fix test on invalid reserved bit value in connect packet
Add send of pubcomp in 02-subpub-qos2 script. To keep the broker session working while launching several tests on the same broker, the last packet of this transaction must be sent.
Fix way of sending packets in compliance tests. According to the documentation of python 3 socket::send method (https://docs.python.org/3/library/socket.html#socket.socket.send), the call to send must be retry until all data is sent while sending packet with a "large" amount of data.