File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11/*
2- Copyright (c) 2000, 2012 , Oracle and/or its affiliates. All rights reserved.
2+ Copyright (c) 2000, 2013 , Oracle and/or its affiliates. All rights reserved.
33
44 This program is free software; you can redistribute it and/or modify
55 it under the terms of the GNU General Public License as published by
@@ -1849,7 +1849,7 @@ static int read_and_execute(bool interactive)
18491849 String buffer;
18501850#endif
18511851
1852- char *line;
1852+ char *line= NULL ;
18531853 char in_string=0 ;
18541854 ulong line_number=0 ;
18551855 bool ml_comment= 0 ;
@@ -1913,6 +1913,13 @@ static int read_and_execute(bool interactive)
19131913#else
19141914 if (opt_outfile)
19151915 fputs (prompt, OUTFILE);
1916+ /*
1917+ free the previous entered line.
1918+ Note: my_free() cannot be used here as the memory was allocated under
1919+ the readline/libedit library.
1920+ */
1921+ if (line)
1922+ free (line);
19161923 line= readline (prompt);
19171924#endif /* defined(__WIN__) */
19181925
@@ -1970,8 +1977,17 @@ static int read_and_execute(bool interactive)
19701977#if defined(__WIN__)
19711978 buffer.free ();
19721979 tmpbuf.free ();
1980+ #else
1981+ if (interactive)
1982+ /*
1983+ free the last entered line.
1984+ Note: my_free() cannot be used here as the memory was allocated under
1985+ the readline/libedit library.
1986+ */
1987+ free (line);
19731988#endif
19741989
1990+
19751991 return status.exit_status ;
19761992}
19771993
Original file line number Diff line number Diff line change @@ -2215,6 +2215,8 @@ mysql_autodetect_character_set(MYSQL *mysql)
22152215 }
22162216#endif
22172217
2218+ if (mysql -> options .charset_name )
2219+ my_free (mysql -> options .charset_name );
22182220 if (!(mysql -> options .charset_name = my_strdup (csname , MYF (MY_WME ))))
22192221 return 1 ;
22202222 return 0 ;
You can’t perform that action at this time.
0 commit comments