Actions
Bug #6745
closedutil/mime: Memory leak at util-decode-mime.c:MimeDecInitParser
Affected Versions:
Effort:
low
Difficulty:
low
Label:
Description
Memory allocated at util-decode-mime.c:2422 for mimeMsg structure, could be lost if state->stack->top == NULL ,
condition is true, since there is no corresponding free call for this case
MimeDecParseState * MimeDecInitParser(void *data,
int (*DataChunkProcessorFunc)(const uint8_t *chunk, uint32_t len,
MimeDecParseState *state))
{
MimeDecParseState *state;
MimeDecEntity *mimeMsg;
state = SCCalloc(1, sizeof(MimeDecParseState));
if (unlikely(state == NULL)) {
return NULL;
}
state->stack = SCCalloc(1, sizeof(MimeDecStack));
if (unlikely(state->stack == NULL)) {
SCFree(state);
return NULL;
}
mimeMsg = SCCalloc(1, sizeof(MimeDecEntity));
if (unlikely(mimeMsg == NULL)) {
SCFree(state->stack);
SCFree(state);
return NULL;
}
mimeMsg->ctnt_flags |= CTNT_IS_MSG;
/* Init state */
state->msg = mimeMsg;
PushStack(state->stack);
if (state->stack->top == NULL) {
SCFree(state->stack);
SCFree(state);
return NULL;
}
state->stack->top->data = mimeMsg;
state->state_flag = HEADER_READY;
state->data = data;
state->DataChunkProcessorFunc = DataChunkProcessorFunc;
return state;
}
Updated by Victor Julien 10 months ago
- Target version changed from 7.0.4 to 8.0.0-beta1
- Label Needs backport to 6.0, Needs backport to 7.0 added
Updated by Victor Julien 10 months ago
- Status changed from In Review to Resolved
Updated by Philippe Antoine 10 months ago
- Status changed from Resolved to Closed
Actions