From 3c1edf3763f8fd571aa28578a481352765e5c6ec Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Sun, 24 Apr 2011 15:58:37 +0200 Subject: [PATCH] Add a file descriptor to the flow file structure. --- src/flow-file.c | 5 +++++ src/flow-file.h | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) 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;