]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Adopt to glib insane GHashTable
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 12 Jun 2017 10:05:20 +0000 (11:05 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 12 Jun 2017 10:05:20 +0000 (11:05 +0100)
src/libserver/milter.c

index de20d1d4dad64e3e3e2364c32d8eec477e2a45b8..18a9a8e24310462fda57c6f78b7e1bfa88a0b2dd 100644 (file)
@@ -518,10 +518,11 @@ rspamd_milter_process_command (struct rspamd_milter_session *session,
                                        num = GPOINTER_TO_INT (res);
                                        num ++;
                                        /*
-                                        * No need to copy, as insert does not call
-                                        * destroy function for a key
+                                        * We need to copy as glib is totally insane about it:
+                                        * > If you supplied a key_destroy_func when creating the
+                                        * > GHashTable, the passed key is freed using that function.
                                         */
-                                       g_hash_table_insert (priv->headers, (gpointer)pos,
+                                       g_hash_table_insert (priv->headers, g_strdup (pos),
                                                        GINT_TO_POINTER (num));
                                }
                                else {