From: Daniel Carl Date: Thu, 31 Jul 2014 16:05:40 +0000 (+0200) Subject: Fix possible uninitialized used of variable. X-Git-Url: https://git.owens.tech/assets/editable-focus.html/assets/editable-focus.html/git?a=commitdiff_plain;h=7453eebabe2f19b7eca6ff79af682dd453b7ea78;p=vimb.git Fix possible uninitialized used of variable. --- diff --git a/src/setting.c b/src/setting.c index 0b6b8da..c9c38c5 100644 --- a/src/setting.c +++ b/src/setting.c @@ -364,8 +364,8 @@ free: static gboolean prepare_setting_value(Setting *prop, void *value, SettingType type, void **newvalue) { gboolean islist, res = false; - int i, vlen; - char *p; + int vlen, i = 0; + char *p = NULL; if ((type != SETTING_APPEND && type != SETTING_PREPEND && type != SETTING_REMOVE) || prop->type == TYPE_BOOLEAN @@ -449,7 +449,7 @@ static gboolean prepare_setting_value(Setting *prop, void *value, SettingType ty *newvalue = g_strconcat(value, prop->value.s, NULL); } res = true; - } else if (type == SETTING_REMOVE) { + } else if (type == SETTING_REMOVE && p) { char *copy = g_strdup(prop->value.s); /* make p to point to the same position in the copy */ p = copy + (p - prop->value.s);