From 9efc90dc5c97f4275a3ec700bc03d22fa8f7355e Mon Sep 17 00:00:00 2001 From: Ian Craggs Date: Mon, 6 Jul 2026 17:37:56 +0100 Subject: [PATCH] Add check to avoid uninitialized free --- src/MQTTPacketOut.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/MQTTPacketOut.c b/src/MQTTPacketOut.c index fe247a6e..dc1b3797 100644 --- a/src/MQTTPacketOut.c +++ b/src/MQTTPacketOut.c @@ -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);