hawq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject incubator-hawq git commit: HAWQ-313. Fix dereference pointer before null check
Date Tue, 05 Jan 2016 03:17:41 GMT
Repository: incubator-hawq
Updated Branches:
  refs/heads/master ca5cce8f1 -> 2ddfa158d


HAWQ-313. Fix dereference pointer before null check


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

Branch: refs/heads/master
Commit: 2ddfa158de9ae19302fedd1f7a0bf98a1f1720cb
Parents: ca5cce8
Author: stanlyxiang <stanly.sxiang@gmail.com>
Authored: Mon Jan 4 16:59:12 2016 +0800
Committer: yaoj2 <jyao@pivotal.io>
Committed: Tue Jan 5 11:10:06 2016 +0800

----------------------------------------------------------------------
 src/backend/cdb/cdbmetadatacache.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/2ddfa158/src/backend/cdb/cdbmetadatacache.c
----------------------------------------------------------------------
diff --git a/src/backend/cdb/cdbmetadatacache.c b/src/backend/cdb/cdbmetadatacache.c
index 22f801c..74f4869 100644
--- a/src/backend/cdb/cdbmetadatacache.c
+++ b/src/backend/cdb/cdbmetadatacache.c
@@ -1435,16 +1435,18 @@ extern Datum gp_metadata_cache_put_entry_for_test(PG_FUNCTION_ARGS)
 
     	bool found;
     	MetadataCacheEntry *entry = (MetadataCacheEntry *)hash_search(MetadataCache, (void *)&key,
HASH_ENTER_NULL, &found);
+        if(entry == NULL)
+        {
+            continue;
+        }
         entry->file_size = 134217728;
         entry->block_num = 1;
 
         AllocMetadataBlock(entry->block_num, &entry->first_block_id, &entry->last_block_id);
 
-    	if(entry != NULL)
-    	{
-    		current++;
-    		success++;
-    	}
+    	current++;
+    	success++;
+
     	if(current == stop)
     	{
     		current = 0;


Mime
View raw message