From 19d0628afca5d15d4dbfbec47b995e59f1f4ce0a Mon Sep 17 00:00:00 2001 From: belliash Date: Thu, 20 Jun 2019 13:36:30 +0200 Subject: [PATCH] Do not try to duplicate an array when source equals to destination. --- engine/hashmap.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/engine/hashmap.c b/engine/hashmap.c index 53a2758..112c943 100644 --- a/engine/hashmap.c +++ b/engine/hashmap.c @@ -1004,6 +1004,12 @@ PH7_PRIVATE sxi32 PH7_HashmapDup(ph7_hashmap *pSrc, ph7_hashmap *pDest) { ph7_value sKey, *pVal; sxi32 rc; sxu32 n; + if(pSrc == pDest) { + /* This should NOT really happen, but never try to duplicate + * an array when source and the destination are the same arrays. + */ + return SXRET_OK; + } /* Point to the first inserted entry in the source */ pEntry = pSrc->pFirst; /* Perform the duplication */