Add check to avoid uninitialized free

This commit is contained in:
Ian Craggs 2026-07-06 17:37:56 +01:00
parent a5aee429c7
commit 9efc90dc5c
No known key found for this signature in database
GPG Key ID: A7AE1A8F2CCAB186
1 changed files with 2 additions and 2 deletions

View File

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2009, 2024 IBM Corp. and Ian Craggs
* Copyright (c) 2009, 2026 IBM Corp. and Ian Craggs
*
* All rights reserved. This program and the accompanying materials
* 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
}
if (pack->qoss->count == 0)
{
if (pack->properties.array)
if (MQTTVersion >= MQTTVERSION_5 && pack->properties.array)
free(pack->properties.array);
ListFree(pack->qoss);
free(pack);