#11 memory allocation correction

This commit is contained in:
1technophile authored and GitHub committed 2017-01-16 20:36:31 +01:00
1 parent 79404afd9d
commit 2efa6f2acc
1 file changed
+1 -1
+1 -1
View File
@@ -74,7 +74,7 @@ void callback(char* topic, byte* payload, unsigned int length) {
// constructing the PUBLISH packet.
trc("Hey I got a callback ");
// Allocate the correct amount of memory for the payload copy
byte* p = (byte*)malloc(length);
byte* p = (byte*)malloc(length + 1);
// Copy the payload to the new buffer
memcpy(p,payload,length);