From 2c9f69f2bf04ea03eb0624e9ac17bf4a66efa7bb Mon Sep 17 00:00:00 2001 From: Bjorn Winckler Date: Tue, 6 Jan 2009 18:31:38 +0100 Subject: [PATCH] Fix double free memory problem This bug was introduced in commit: e162109d6f022942edb7281736f587ee79e20bfe --- src/MacVim/MMBackend.m | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/MacVim/MMBackend.m b/src/MacVim/MMBackend.m index 97d4ddcfbe..a532180179 100644 --- a/src/MacVim/MMBackend.m +++ b/src/MacVim/MMBackend.m @@ -2528,11 +2528,8 @@ static NSString *MMSymlinkWarningString = { // NOTE: This code is essentially identical to server_to_input_buf(), // except the 'silent' flag is TRUE in the call to ins_typebuf() below. - char_u *str = [input vimStringSave]; - char_u *ptr = NULL; - char_u *cpo_save = p_cpo; - - if (!str) return; + char_u *string = [input vimStringSave]; + if (!string) return; /* Set 'cpoptions' the way we want it. * B set - backslashes are *not* treated specially @@ -2541,8 +2538,10 @@ static NSString *MMSymlinkWarningString = * The last but one parameter of replace_termcodes() is TRUE so that the * sequence is recognised - needed for a real backslash. */ + char_u *ptr = NULL; + char_u *cpo_save = p_cpo; p_cpo = (char_u *)"Bk"; - str = replace_termcodes((char_u *)str, &ptr, FALSE, TRUE, FALSE); + char_u *str = replace_termcodes((char_u *)string, &ptr, FALSE, TRUE, FALSE); p_cpo = cpo_save; if (*ptr != NUL) /* trailing CTRL-V results in nothing */ @@ -2563,8 +2562,8 @@ static NSString *MMSymlinkWarningString = * buffer. */ typebuf_was_filled = TRUE; } - vim_free((char_u *)ptr); - vim_free(str); + vim_free(ptr); + vim_free(string); } - (BOOL)unusedEditor