From 324a29c6e848c980b95b98890383403d8a2a47e2 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Thu, 18 Mar 2021 10:31:00 +0000 Subject: [PATCH] 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 --- 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;