trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zw...@apache.org
Subject trafficserver git commit: TS-3505 Coverity is smarter than me...
Date Sun, 26 Apr 2015 14:27:09 GMT
Repository: trafficserver
Updated Branches:
  refs/heads/master 449449b0f -> d9f1bc531


TS-3505 Coverity is smarter than me...


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/d9f1bc53
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/d9f1bc53
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/d9f1bc53

Branch: refs/heads/master
Commit: d9f1bc531fef27c18e3fd4f53d91843f08118a54
Parents: 449449b
Author: Leif Hedstrom <zwoop@apache.org>
Authored: Sun Apr 26 08:22:56 2015 -0600
Committer: Leif Hedstrom <zwoop@apache.org>
Committed: Sun Apr 26 08:24:49 2015 -0600

----------------------------------------------------------------------
 plugins/experimental/cache_promote/cache_promote.cc | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d9f1bc53/plugins/experimental/cache_promote/cache_promote.cc
----------------------------------------------------------------------
diff --git a/plugins/experimental/cache_promote/cache_promote.cc b/plugins/experimental/cache_promote/cache_promote.cc
index e74527b..76368a2 100644
--- a/plugins/experimental/cache_promote/cache_promote.cc
+++ b/plugins/experimental/cache_promote/cache_promote.cc
@@ -459,20 +459,21 @@ TSRemapInit(TSRemapInterface *api_info, char *errbuf, int errbuf_size)
 TSReturnCode
 TSRemapNewInstance(int argc, char *argv[], void **ih, char * /* errbuf */, int /* errbuf_size
*/)
 {
-  // coverity[RESOURCE_LEAK];
   PromotionConfig *config = new PromotionConfig;
-  TSCont contp = TSContCreate(cont_handle_policy, TSMutexCreate());
 
   --argc;
   ++argv;
   if (config->factory(argc, argv)) {
+    TSCont contp = TSContCreate(cont_handle_policy, TSMutexCreate());
+
     TSContDataSet(contp, static_cast<void *>(config));
     *ih = static_cast<void *>(contp);
 
     return TS_SUCCESS;
+  } else {
+    delete config;
+    return TS_ERROR;
   }
-
-  return TS_ERROR;
 }
 
 void


Mime
View raw message