Declare variable at the beggining of the block.

Signed-off-by: Adrian Moran <amoran@ikerlan.es>
This commit is contained in:
Adrian Moran 2020-03-24 12:06:41 +01:00
parent eff73419d4
commit 433c8a173f
1 changed files with 2 additions and 1 deletions

View File

@ -330,12 +330,13 @@ int MQTTProtocol_handlePublishes(void* pack, int sock)
int already_received = 0;
ListElement* listElem = NULL;
Messages* m = malloc(sizeof(Messages));
Publications* p = NULL;
if (!m)
{
rc = PAHO_MEMORY_ERROR;
goto exit;
}
Publications* p = MQTTProtocol_storePublication(publish, &len);
p = MQTTProtocol_storePublication(publish, &len);
m->publish = p;
m->msgid = publish->msgId;