From db56915498413ce24957f6ac272bfa495a34253f Mon Sep 17 00:00:00 2001 From: Andrew Pamment Date: Tue, 22 May 2018 21:37:23 +1000 Subject: [PATCH] fixes.. --- utils/mnettoss/mnettoss.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/utils/mnettoss/mnettoss.c b/utils/mnettoss/mnettoss.c index aa15f75..31eadc3 100644 --- a/utils/mnettoss/mnettoss.c +++ b/utils/mnettoss/mnettoss.c @@ -274,6 +274,15 @@ int import(char *filename) { fread(&msg, sizeof(struct msg_t), 1, fptr); + body = malloc(st.st_size - sizeof(struct msg_t) + 1); + + memset(body, 0, st.st_size - sizeof(struct msg_t) + 1); + + fread(body, st.st_size - sizeof(struct msg_t), 1, fptr); + + fclose(fptr); + + for (i=0;iid) { areaid = i; @@ -298,20 +307,15 @@ int import(char *filename) { ret = isdupe(&msg, uuid); if (ret == -1) { + free(body); fclose(fptr); return 0; } else if (ret == 1) { + free(body); fclose(fptr); return 1; } - body = malloc(st.st_size - sizeof(struct msg_t) + 1); - - memset(body, 0, st.st_size - sizeof(struct msg_t) + 1); - - fread(body, st.st_size - sizeof(struct msg_t), 1, fptr); - - fclose(fptr); JAM_ClearMsgHeader(&jmh); jmh.DateWritten = msg.timedate;