diff options
author | dkf <dkf@noemail.net> | 2008-06-08 23:13:08 (GMT) |
---|---|---|
committer | dkf <dkf@noemail.net> | 2008-06-08 23:13:08 (GMT) |
commit | b7146f3be078fa4c7c60a46ac4dc407477f4d7ba (patch) | |
tree | 09f75776cc9adc280d09fb5ab0e61e4c641380b2 /generic/tclOOCall.c | |
parent | c3eda0676a687e900f9e4e2e8b0a9d64386cddfa (diff) | |
download | tcl-b7146f3be078fa4c7c60a46ac4dc407477f4d7ba.zip tcl-b7146f3be078fa4c7c60a46ac4dc407477f4d7ba.tar.gz tcl-b7146f3be078fa4c7c60a46ac4dc407477f4d7ba.tar.bz2 |
Plug leak. [Bug 1987817]
FossilOrigin-Name: a3fd190cc6297bce8f63a362417e720751f52886
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); |