diff options
Diffstat (limited to 'generic/tclOOCall.c')
-rw-r--r-- | generic/tclOOCall.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/generic/tclOOCall.c b/generic/tclOOCall.c index 8a4024d..c5c9418 100644 --- a/generic/tclOOCall.c +++ b/generic/tclOOCall.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclOOCall.c,v 1.5 2008/05/31 23:35:27 das Exp $ + * RCS: @(#) $Id: tclOOCall.c,v 1.6 2008/06/08 23:13:09 dkf Exp $ */ #ifdef HAVE_CONFIG_H @@ -431,8 +431,14 @@ TclOOGetSortedMethodList( * dealing with public method names. */ - qsort((void *) strings, (unsigned) i, sizeof(char *), CmpStr); - *stringsPtr = strings; + if (i > 0) { + if (i > 1) { + qsort((void *) strings, (unsigned) i, sizeof(char *), CmpStr); + } + *stringsPtr = strings; + } else { + ckfree((char *) strings); + } } Tcl_DeleteHashTable(&names); @@ -492,8 +498,14 @@ TclOOGetSortedClassMethodList( * dealing with public method names. */ - qsort((void *) strings, (unsigned) i, sizeof(char *), CmpStr); - *stringsPtr = strings; + if (i > 0) { + if (i > 1) { + qsort((void *) strings, (unsigned) i, sizeof(char *), CmpStr); + } + *stringsPtr = strings; + } else { + ckfree((char *) strings); + } } Tcl_DeleteHashTable(&names); |