trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jpe...@apache.org
Subject [1/2] trafficserver git commit: TS-3287: fix array comparison to NULL errors
Date Tue, 03 Feb 2015 21:25:03 GMT
Repository: trafficserver
Updated Branches:
  refs/heads/master 84e44deb4 -> 2d77660a2


TS-3287: fix array comparison to NULL errors

Coverity CID #1214711
Coverity CID #1216304


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

Branch: refs/heads/master
Commit: 2d77660a266e72b9954d846f1a066ca6a926c036
Parents: 6072c21
Author: James Peach <jpeach@apache.org>
Authored: Wed Jan 28 13:45:41 2015 -0800
Committer: James Peach <jpeach@apache.org>
Committed: Tue Feb 3 13:24:41 2015 -0800

----------------------------------------------------------------------
 plugins/experimental/ts_lua/ts_lua_util.c |  2 +-
 plugins/experimental/url_sig/url_sig.c    | 15 ++++++---------
 2 files changed, 7 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/2d77660a/plugins/experimental/ts_lua/ts_lua_util.c
----------------------------------------------------------------------
diff --git a/plugins/experimental/ts_lua/ts_lua_util.c b/plugins/experimental/ts_lua/ts_lua_util.c
index 868618d..658b6ab 100644
--- a/plugins/experimental/ts_lua/ts_lua_util.c
+++ b/plugins/experimental/ts_lua/ts_lua_util.c
@@ -132,7 +132,7 @@ ts_lua_add_module(ts_lua_instance_conf * conf, ts_lua_main_ctx * arr,
int n, int
         return -1;
       }
 
-    } else if (conf->script) {
+    } else if (strlen(conf->script)) {
       if (luaL_loadfile(L, conf->script)) {
         TSError("[%s] luaL_loadfile %s failed: %s", __FUNCTION__, conf->script, lua_tostring(L,
-1));
         lua_pop(L, 1);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/2d77660a/plugins/experimental/url_sig/url_sig.c
----------------------------------------------------------------------
diff --git a/plugins/experimental/url_sig/url_sig.c b/plugins/experimental/url_sig/url_sig.c
index 0adf23c..0644fd3 100644
--- a/plugins/experimental/url_sig/url_sig.c
+++ b/plugins/experimental/url_sig/url_sig.c
@@ -71,12 +71,7 @@ TSRemapNewInstance(int argc, char *argv[], void **ih, char *errbuf, int
errbuf_s
   struct config *cfg;
 
   cfg = TSmalloc(sizeof(struct config));
-  *ih = (void *) cfg;
-
-  int i = 0;
-  for (i = 0; i < MAX_KEY_NUM; i++) {
-    cfg->keys[i][0] = '\0';
-  }
+  memset(cfg, 0, sizeof(struct config));
 
   if (argc != 3) {
     snprintf(errbuf, errbuf_size - 1,
@@ -187,11 +182,13 @@ TSRemapNewInstance(int argc, char *argv[], void **ih, char *errbuf,
int errbuf_s
 
   }
 
-  for (i = 0; i < MAX_KEY_NUM; i++) {
-    if (cfg->keys[i] != NULL && strlen(cfg->keys[i]) > 0)
-      TSDebug(PLUGIN_NAME, "shared secret key[%d] = %s\n", i, cfg->keys[i]);
+  for (unsigned i = 0; i < MAX_KEY_NUM; i++) {
+    if (strlen(cfg->keys[i]) > 0)
+      TSDebug(PLUGIN_NAME, "shared secret key[%i] = %s\n", i, cfg->keys[i]);
   }
   fclose(file);
+
+  *ih = (void *) cfg;
   return TS_SUCCESS;
 }
 


Mime
View raw message