diff --git a/src/util-file.c b/src/util-file.c index ce7958dd3713..f41c1b075047 100644 --- a/src/util-file.c +++ b/src/util-file.c @@ -913,8 +913,8 @@ static File *FileOpenFile(FileContainer *ffc, const StreamingBufferConfig *sbcfg FileContainerAdd(ffc, ff); + ff->size += data_len; if (data != NULL) { - ff->size += data_len; if (AppendData(ff, data, data_len) != 0) { ff->state = FILE_STATE_ERROR; SCReturnPtr(NULL, "File"); @@ -955,8 +955,8 @@ int FileCloseFilePtr(File *ff, const uint8_t *data, SCReturnInt(-1); } + ff->size += data_len; if (data != NULL) { - ff->size += data_len; if (ff->flags & FILE_NOSTORE) { #ifdef HAVE_NSS /* no storage but hashing */