|
|
|
@ -172,7 +172,7 @@ int persist__chunk_base_msg_read_v234(FILE *db_fptr, struct P_base_msg *chunk, u
|
|
|
|
|
chunk->F.payloadlen = ntohl(i32temp);
|
|
|
|
|
|
|
|
|
|
if(chunk->F.payloadlen){
|
|
|
|
|
chunk->payload = mosquitto_malloc(chunk->F.payloadlen+1);
|
|
|
|
|
chunk->payload = mosquitto_calloc(chunk->F.payloadlen+1, 1);
|
|
|
|
|
if(chunk->payload == NULL){
|
|
|
|
|
mosquitto__FREE(chunk->source.id);
|
|
|
|
|
mosquitto__FREE(chunk->source.username);
|
|
|
|
@ -181,8 +181,6 @@ int persist__chunk_base_msg_read_v234(FILE *db_fptr, struct P_base_msg *chunk, u
|
|
|
|
|
return MOSQ_ERR_NOMEM;
|
|
|
|
|
}
|
|
|
|
|
read_e(db_fptr, chunk->payload, chunk->F.payloadlen);
|
|
|
|
|
/* Ensure zero terminated regardless of contents */
|
|
|
|
|
((uint8_t *)chunk->payload)[chunk->F.payloadlen] = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return MOSQ_ERR_SUCCESS;
|
|
|
|
|