Skip to content

Commit 9efc90d

Browse files
committed
Add check to avoid uninitialized free
1 parent a5aee42 commit 9efc90d

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/MQTTPacketOut.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2009, 2024 IBM Corp. and Ian Craggs
2+
* Copyright (c) 2009, 2026 IBM Corp. and Ian Craggs
33
*
44
* All rights reserved. This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License v2.0
@@ -341,7 +341,7 @@ void* MQTTPacket_suback(int MQTTVersion, unsigned char aHeader, char* data, size
341341
}
342342
if (pack->qoss->count == 0)
343343
{
344-
if (pack->properties.array)
344+
if (MQTTVersion >= MQTTVERSION_5 && pack->properties.array)
345345
free(pack->properties.array);
346346
ListFree(pack->qoss);
347347
free(pack);

0 commit comments

Comments
 (0)