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;