]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Pull request #4651: file_api: making current_context as nullptr before it gets the...
authorSumit Kumar (sumikum7) <sumikum7@cisco.com>
Wed, 26 Mar 2025 09:35:39 +0000 (09:35 +0000)
committerLokesh Bevinamarad (lbevinam) <lbevinam@cisco.com>
Wed, 26 Mar 2025 09:35:39 +0000 (09:35 +0000)
Merge in SNORT/snort3 from ~SUMIKUM7/snort3:coverity_CSCwo20068_snort to master

Squashed commit of the following:

commit 4004df617faf5598c181ae672b1b304e3e440c1b
Author: Sumit Kumar <sumikum7@cisco.com>
Date:   Wed Mar 5 15:31:53 2025 +0530

    file_api: making current_context as nullptr before it gets the value of ctx

    file_api: since current_context would never be file_got hence removing this style check

    file_api: making current_context as nullptr before it gets the value of ctx and removing redundant part of if check

src/file_api/file_flows.cc

index 51a33aec12c157e6e2c9e92e9b2a4a50f9724591..de855e5bb53d035ae78a0e5dacebaaef0a7930f4 100644 (file)
@@ -173,11 +173,12 @@ void FileFlows::set_current_file_context(FileContext* ctx)
     {
         int64_t file_id  = current_context->get_file_id();
         delete current_context;
+        current_context = nullptr;
         current_context_delete_pending = false;
         FileCache* file_cache = FileService::get_file_cache();
         assert(file_cache);
         FileContext* file_got = file_cache->get_file(flow, file_id, false, false);
-        if (file_got and file_got->verdict == FILE_VERDICT_PENDING and current_context != file_got)
+        if (file_got and file_got->verdict == FILE_VERDICT_PENDING)
         {
             file_got->user_file_data_mutex.lock();
             delete(file_got->get_file_data());