[glib/mcatanzaro/glib-2-56-rhel8: 27/45] ghash: Use g_memdup2() instead of g_memdup()




commit 41baea6887b1bf7ef20088e2545880fcc72c4986
Author: Simon McVittie <smcv collabora com>
Date:   Thu Mar 18 10:31:00 2021 +0000

    ghash: Use g_memdup2() instead of g_memdup()
    
    Backport of part of commit 0736b7c1e7cf4232c5d7eb2b0fbfe9be81bd3baa
    to the simpler structure of the GHashTable code in glib-2-58.
    
    Helps: #2319
    Signed-off-by: Simon McVittie <smcv collabora com>

 glib/ghash.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/glib/ghash.c b/glib/ghash.c
index 6bb04a50d..608d136f4 100644
--- a/glib/ghash.c
+++ b/glib/ghash.c
@@ -34,6 +34,7 @@
 
 #include "glib-private.h"
 #include "gstrfuncs.h"
+#include "gstrfuncsprivate.h"
 #include "gatomic.h"
 #include "gtestutils.h"
 #include "gslice.h"
@@ -967,7 +968,7 @@ g_hash_table_insert_node (GHashTable *hash_table,
    * split the table.
    */
   if (G_UNLIKELY (hash_table->keys == hash_table->values && hash_table->keys[node_index] != new_value))
-    hash_table->values = g_memdup (hash_table->keys, sizeof (gpointer) * hash_table->size);
+    hash_table->values = g_memdup2 (hash_table->keys, sizeof (gpointer) * hash_table->size);
 
   /* Step 3: Actually do the write */
   hash_table->values[node_index] = new_value;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]