diff options
author | hobbs <hobbs> | 2002-04-12 07:28:06 (GMT) |
---|---|---|
committer | hobbs <hobbs> | 2002-04-12 07:28:06 (GMT) |
commit | ce8d1881cdef6d380eb6e68d69c5c60193339188 (patch) | |
tree | 5734c5778625dbac3f7e24a513b3fab9bd2092d0 | |
parent | ecbfe31e9b700c9e01f2154738f9fd05716b11d1 (diff) | |
download | tk-ce8d1881cdef6d380eb6e68d69c5c60193339188.zip tk-ce8d1881cdef6d380eb6e68d69c5c60193339188.tar.gz tk-ce8d1881cdef6d380eb6e68d69c5c60193339188.tar.bz2 |
generic/tkMenu.c (ConfigureMenu): freed saved options in all error cases
-rw-r--r-- | generic/tkMenu.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/generic/tkMenu.c b/generic/tkMenu.c index e3e004f..846d7a0 100644 --- a/generic/tkMenu.c +++ b/generic/tkMenu.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMenu.c,v 1.17 2002/03/20 22:55:16 dgp Exp $ + * RCS: @(#) $Id: tkMenu.c,v 1.18 2002/04/12 07:28:06 hobbs Exp $ */ /* @@ -1536,6 +1536,11 @@ ConfigureMenu(interp, menuPtr, objc, objv) ckfree((char *) cleanupPtr->errorStructPtr); cleanupPtr->errorStructPtr = NULL; } + if (menuListPtr->errorStructPtr != NULL) { + Tk_RestoreSavedOptions(menuListPtr->errorStructPtr); + ckfree((char *) menuListPtr->errorStructPtr); + menuListPtr->errorStructPtr = NULL; + } return TCL_ERROR; } @@ -1576,18 +1581,18 @@ ConfigureMenu(interp, menuPtr, objc, objv) if ((menuListPtr->numEntries == 0) || (menuListPtr->entries[0]->type != TEAROFF_ENTRY)) { if (MenuNewEntry(menuListPtr, 0, TEAROFF_ENTRY) == NULL) { - if (menuListPtr->errorStructPtr != NULL) { - for (cleanupPtr = menuPtr->masterMenuPtr; - cleanupPtr != menuListPtr; - cleanupPtr = cleanupPtr->nextInstancePtr) { - Tk_RestoreSavedOptions(cleanupPtr->errorStructPtr); - ckfree((char *) cleanupPtr->errorStructPtr); - cleanupPtr->errorStructPtr = NULL; - } + for (cleanupPtr = menuPtr->masterMenuPtr; + cleanupPtr != menuListPtr; + cleanupPtr = cleanupPtr->nextInstancePtr) { Tk_RestoreSavedOptions(cleanupPtr->errorStructPtr); ckfree((char *) cleanupPtr->errorStructPtr); cleanupPtr->errorStructPtr = NULL; } + if (menuListPtr->errorStructPtr != NULL) { + Tk_RestoreSavedOptions(menuListPtr->errorStructPtr); + ckfree((char *) menuListPtr->errorStructPtr); + menuListPtr->errorStructPtr = NULL; + } return TCL_ERROR; } } |