You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hawq.apache.org by wl...@apache.org on 2016/01/22 08:36:49 UTC

incubator-hawq git commit: HAWQ-274. Fix coverity error

Repository: incubator-hawq
Updated Branches:
  refs/heads/master 2c3584178 -> facb61d16


HAWQ-274. Fix coverity error


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

Branch: refs/heads/master
Commit: facb61d16184eaeb343ebddfa01edf843652622b
Parents: 2c35841
Author: Wen Lin <wl...@pivotal.io>
Authored: Fri Jan 22 15:36:08 2016 +0800
Committer: Wen Lin <wl...@pivotal.io>
Committed: Fri Jan 22 15:36:08 2016 +0800

----------------------------------------------------------------------
 src/backend/cdb/cdbtmpdir.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/facb61d1/src/backend/cdb/cdbtmpdir.c
----------------------------------------------------------------------
diff --git a/src/backend/cdb/cdbtmpdir.c b/src/backend/cdb/cdbtmpdir.c
index eff6921..aef015f 100644
--- a/src/backend/cdb/cdbtmpdir.c
+++ b/src/backend/cdb/cdbtmpdir.c
@@ -72,9 +72,11 @@ void getLocalTmpDirFromMasterConfig(int session_id)
     List *tmpdirs = NULL;
 
     tmpdirs = initTmpDirList(tmpdirs, rm_master_tmp_dirs);
-    LocalTempPath = pstrdup((char *)lfirst(list_nth_cell(tmpdirs, gp_session_id % list_length(tmpdirs))));
-
-    destroyTmpDirList(tmpdirs);
+    if (tmpdirs != NULL )
+    {
+        LocalTempPath = pstrdup((char *)lfirst(list_nth_cell(tmpdirs, gp_session_id % list_length(tmpdirs))));
+        destroyTmpDirList(tmpdirs);
+    }
 }
 
 void getLocalTmpDirFromSegmentConfig(int session_id, int command_id, int qeidx)
@@ -92,8 +94,11 @@ void getLocalTmpDirFromSegmentConfig(int session_id, int command_id, int qeidx)
         tmpdirs = initTmpDirList(tmpdirs, rm_seg_tmp_dirs);
         int64_t session_key = session_id;
         int64_t key = (session_key << 32) + command_id + qeidx;
-        LocalTempPath = pstrdup((char *)lfirst(list_nth_cell(tmpdirs, key % list_length(tmpdirs))));
-        destroyTmpDirList(tmpdirs);
+        if (tmpdirs != NULL )
+        {
+            LocalTempPath = pstrdup((char *)lfirst(list_nth_cell(tmpdirs, key % list_length(tmpdirs))));
+            destroyTmpDirList(tmpdirs);
+        }
     }
 }