We should goto fail as topic is allocated.
Follow-up to
92fd791
Closes #19417
remaininglength = payloadlen + 2 + topiclen;
encodelen = mqtt_encode_len(encodedbytes, remaininglength);
- if(MAX_MQTT_MESSAGE_SIZE - remaininglength - 1 < encodelen)
- return CURLE_TOO_LARGE;
+ if(MAX_MQTT_MESSAGE_SIZE - remaininglength - 1 < encodelen) {
+ result = CURLE_TOO_LARGE;
+ goto fail;
+ }
/* add the control byte and the encoded remaining length */
pkt = malloc(remaininglength + 1 + encodelen);