From 27ec7f0f1e7aaddec8eb4ce9f23922c0fcab999a Mon Sep 17 00:00:00 2001 From: Emanuele Giaquinta Date: Mon, 16 Apr 2007 00:27:43 +0000 Subject: [PATCH] Properly initialize reference count for a new setting, bug #235. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4452 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/core/settings.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/settings.c b/src/core/settings.c index be49d800..28036438 100644 --- a/src/core/settings.c +++ b/src/core/settings.c @@ -181,8 +181,10 @@ static void settings_add(const char *module, const char *section, "setting '%s' with different type.", key); return; } + rec->refcount++; } else { rec = g_new(SETTINGS_REC, 1); + rec->refcount = 1; rec->module = g_strdup(module); rec->key = g_strdup(key); rec->section = g_strdup(section); @@ -191,8 +193,6 @@ static void settings_add(const char *module, const char *section, rec->default_value = *default_value; g_hash_table_insert(settings, rec->key, rec); } - - rec->refcount++; } void settings_add_str_module(const char *module, const char *section,