diff --git a/src/flow-file.c b/src/flow-file.c index e0ba493b9b..aad4f71555 100644 --- a/src/flow-file.c +++ b/src/flow-file.c @@ -177,6 +177,8 @@ static FlowFile *FlowFileAlloc(uint8_t *name, uint16_t name_len) { } memset(new, 0, sizeof(FlowFile)); + new->fd = -1; + new->name = SCMalloc(name_len); if (new->name == NULL) { SCFree(new); @@ -193,6 +195,9 @@ static void FlowFileFree(FlowFile *ff) { if (ff == NULL) return; + if (ff->fd != -1) + close(ff->fd); + if (ff->name != NULL) SCFree(ff->name); SCFree(ff); diff --git a/src/flow-file.h b/src/flow-file.h index dcd9f7d91b..8482dbb055 100644 --- a/src/flow-file.h +++ b/src/flow-file.h @@ -53,7 +53,8 @@ typedef struct FlowFileData_ { typedef struct FlowFile_ { uint8_t *name; uint16_t name_len; - FlowFileState state; + int16_t state; + int fd; /**< file discriptor for storing files */ FlowFileData *chunks_head; FlowFileData *chunks_tail; struct FlowFile_ *next;