Commit 3e0bb3bf authored by Simon McVittie's avatar Simon McVittie
Browse files

ghash: Use g_memdup2() instead of g_memdup()

Backport of part of commit 0736b7c1
to the simpler structure of the GHashTable code in glib-2-58.

Helps: #2319

Signed-off-by: Simon McVittie's avatarSimon McVittie <smcv@collabora.com>
parent 0ace82d7
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment