OSDN Git Service

自動拾いエディタでfreeした領域をアクセスしているバグを修正。
authorhabu <habu@0568b783-4c39-0410-ac80-bf13821ea2a2>
Mon, 8 Feb 2010 14:33:31 +0000 (14:33 +0000)
committerhabu <habu@0568b783-4c39-0410-ac80-bf13821ea2a2>
Mon, 8 Feb 2010 14:33:31 +0000 (14:33 +0000)
(vがs_keepが保持しているヒープ領域上を指す事がある)

src/autopick.c

index 50efa1c..1279476 100644 (file)
@@ -4623,13 +4623,13 @@ static void draw_text_editor(text_body_type *tb)
                        /* Parse the expr */
                        v = process_pref_file_expr(&ss, &f);
 
-                       /* Cannot use string_free() because the string was "destroyed" */
-                       C_FREE(s_keep, s_len + 1, char);
-
                        /* Set flag */
                        if (streq(v, "0")) state |= LSTAT_BYPASS;
                        else state &= ~LSTAT_BYPASS;
 
+                       /* Cannot use string_free() because the string was "destroyed" */
+                       C_FREE(s_keep, s_len + 1, char);
+
                        /* Re-update this line's state */
                        tb->states[y] = state | LSTAT_EXPRESSION;
                }