diff options
author | Max Horn | 2009-03-24 12:01:54 +0000 |
---|---|---|
committer | Max Horn | 2009-03-24 12:01:54 +0000 |
commit | c1be6e1ed68fdb9826a5fe189f01c520238e37af (patch) | |
tree | 8ec7719e401b58a3d6825c551bf708fe6c62241f /engines/sci | |
parent | 9ea32d4aa12329d3bfe163664f5d84d7318c01db (diff) | |
download | scummvm-rg350-c1be6e1ed68fdb9826a5fe189f01c520238e37af.tar.gz scummvm-rg350-c1be6e1ed68fdb9826a5fe189f01c520238e37af.tar.bz2 scummvm-rg350-c1be6e1ed68fdb9826a5fe189f01c520238e37af.zip |
SCI: Fixed some leaks introduced by my previous changes
svn-id: r39660
Diffstat (limited to 'engines/sci')
-rw-r--r-- | engines/sci/gfx/menubar.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/engines/sci/gfx/menubar.cpp b/engines/sci/gfx/menubar.cpp index a586b798e0..7a01cac7c9 100644 --- a/engines/sci/gfx/menubar.cpp +++ b/engines/sci/gfx/menubar.cpp @@ -101,7 +101,7 @@ int Menu::addMenuItem(gfx_state_t *state, MenuType type, const char *left, const void Menubar::addMenu(gfx_state_t *state, const char *title, const char *entries, int font, reg_t entries_base) { char tracker; - char *left = NULL, *right; + char *left = NULL; reg_t left_origin = entries_base; int string_len = 0; int tag = 0, c_width, max_width = 0; @@ -150,6 +150,7 @@ void Menubar::addMenu(gfx_state_t *state, const char *title, const char *entries max_width = c_width; string_len = 0; + free(left); left = NULL; // Start over } else if (tracker == '`') { // Start of right string if (!left) { @@ -165,7 +166,7 @@ void Menubar::addMenu(gfx_state_t *state, const char *title, const char *entries if ((tracker == ':') || (tracker == 0)) { // End of entry int key, modifiers = 0; - right = sci_strndup(entries - string_len - 1, string_len); + char *right = sci_strndup(entries - string_len - 1, string_len); if (right[0] == '#') { right[0] = SCI_SPECIAL_CHAR_FUNCTION; // Function key @@ -190,7 +191,7 @@ void Menubar::addMenu(gfx_state_t *state, const char *title, const char *entries if (right[2] == '=') { tag = atoi(right + 3); right[2] = 0; - }; + } } else { if (right[0] == '^') { right[0] = SCI_SPECIAL_CHAR_CTRL; // Control key - there must be a replacement... @@ -230,6 +231,8 @@ void Menubar::addMenu(gfx_state_t *state, const char *title, const char *entries max_width = c_width; string_len = 0; + free(right); + free(left); left = NULL; // Start over } else |