--- libaitmqtt/src/aitmqtt.c 2022/09/13 20:12:15 1.3.4.1 +++ libaitmqtt/src/aitmqtt.c 2022/09/13 22:20:59 1.3.4.3 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: aitmqtt.c,v 1.3.4.1 2022/09/13 20:12:15 misho Exp $ +* $Id: aitmqtt.c,v 1.3.4.3 2022/09/13 22:20:59 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -12,7 +12,7 @@ terms: All of the documentation and software included in the ELWIX and AITNET Releases is copyrighted by ELWIX - Sofia/Bulgaria -Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 +Copyright 2004 - 2022 by Michael Pounov . All rights reserved. Redistribution and use in source and binary forms, with or without @@ -107,18 +107,18 @@ _mqtt_readHEADER(mqtt_msg_t * __restrict buf, u_char c * mqtt_msgFree() Free MQTT message * * @msg = Message buffer - * @all = !=0 Destroy entire message, if MQTT Message allocated with mqtt_msgAlloc() + * @keepmsg = !=0 just free message content * return: none */ void -mqtt_msgFree(mqtt_msg_t ** __restrict msg, int all) +mqtt_msgFree(mqtt_msg_t ** __restrict msg, int keepmsg) { if (msg && *msg) { if ((*msg)->msg_base) { free((*msg)->msg_base); (*msg)->msg_base = NULL; } - if (all) { + if (!keepmsg) { free(*msg); *msg = NULL; } else @@ -422,13 +422,13 @@ mqtt_subAlloc(u_short num) mqtt_subscr_t * mqtt_subRealloc(mqtt_subscr_t ** __restrict subs, u_short num) { - mqtt_subscr_t **ss, *s = NULL; + mqtt_subscr_t *ss, *s = NULL; register int i; if (!subs) return NULL; - for (i = 0, ss = subs; *ss; i++, ss++); + for (i = 0, ss = *subs; ss; i++, ss++); if (i < num) return NULL; if (i == num)