diff --git a/src/MQTTAsyncUtils.c b/src/MQTTAsyncUtils.c index d5564809..a090a6a6 100644 --- a/src/MQTTAsyncUtils.c +++ b/src/MQTTAsyncUtils.c @@ -1441,7 +1441,10 @@ static int MQTTAsync_processCommand(void) else { if (rc != SOCKET_ERROR) - command->command.details.pub.destinationName = NULL; /* this will be freed by the protocol code */ + { + command->command.details.pub.payload = NULL; /* this will be freed by the protocol code */ + command->command.details.pub.destinationName = NULL; /* this will be freed by the protocol code */ + } command->client->pending_write = &command->command; } }