about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog2
-rw-r--r--Src/params.c11
2 files changed, 9 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index f74c26b88..e3628cfa7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2018-01-04  Peter Stephenson  <p.stephenson@samsung.com>
 
+	* Stephane: 42159: Src/params.c: avoid crash copying empty hash table.
+
 	* Sebastian: 42188: Src/Modules/system.c: It is necessary to
 	close the lock descriptor in some failure cases.
 
diff --git a/Src/params.c b/Src/params.c
index 31ff0445b..de7730ae7 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -549,10 +549,13 @@ scancopyparams(HashNode hn, UNUSED(int flags))
 HashTable
 copyparamtable(HashTable ht, char *name)
 {
-    HashTable nht = newparamtable(ht->hsize, name);
-    outtable = nht;
-    scanhashtable(ht, 0, 0, 0, scancopyparams, 0);
-    outtable = NULL;
+    HashTable nht = 0;
+    if (ht) {
+	nht = newparamtable(ht->hsize, name);
+	outtable = nht;
+	scanhashtable(ht, 0, 0, 0, scancopyparams, 0);
+	outtable = NULL;
+    }
     return nht;
 }