You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by wk...@apache.org on 2023/09/18 22:21:23 UTC

[trafficserver] branch master updated: Fix potential resource leak in ja3_fingerprint plugin. (#10411)

This is an automated email from the ASF dual-hosted git repository.

wkaras pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new b99a387b93 Fix potential resource leak in ja3_fingerprint plugin. (#10411)
b99a387b93 is described below

commit b99a387b9393e087e7acf1ef5feecac9d7b00eef
Author: Walt Karas <wk...@yahooinc.com>
AuthorDate: Mon Sep 18 18:21:16 2023 -0400

    Fix potential resource leak in ja3_fingerprint plugin. (#10411)
    
    Coverity issue CID 1508991
---
 plugins/ja3_fingerprint/ja3_fingerprint.cc | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/plugins/ja3_fingerprint/ja3_fingerprint.cc b/plugins/ja3_fingerprint/ja3_fingerprint.cc
index 79859abde5..6e0e8245c9 100644
--- a/plugins/ja3_fingerprint/ja3_fingerprint.cc
+++ b/plugins/ja3_fingerprint/ja3_fingerprint.cc
@@ -496,7 +496,7 @@ TSReturnCode
 TSRemapNewInstance(int argc, char *argv[], void **ih, char * /* errbuf ATS_UNUSED */, int /* errbuf_size ATS_UNUSED */)
 {
   TSDebug(PLUGIN_NAME, "New instance for client matching %s to %s", argv[0], argv[1]);
-  ja3_remap_info *pri = new ja3_remap_info;
+  std::unique_ptr<ja3_remap_info> pri{new ja3_remap_info};
 
   // Parse parameters
   if (!read_config_option(argc - 1, const_cast<const char **>(argv + 1), pri->raw, pri->log)) {
@@ -511,10 +511,10 @@ TSRemapNewInstance(int argc, char *argv[], void **ih, char * /* errbuf ATS_UNUSE
 
   // Create continuation
   pri->handler = TSContCreate(req_hdr_ja3_handler, nullptr);
-  TSContDataSet(pri->handler, pri);
+  TSContDataSet(pri->handler, pri.get());
 
   // Pass to other remap plugin functions
-  *ih = static_cast<void *>(pri);
+  *ih = static_cast<void *>(pri.release());
   return TS_SUCCESS;
 }