summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2008-06-08 23:13:08 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2008-06-08 23:13:08 (GMT)
commit903ca7048a4ab89a4962196a979014681d5db909 (patch)
tree09f75776cc9adc280d09fb5ab0e61e4c641380b2 /generic
parent4819a5befc336eb974ac83e7b8cd60cb3b4b695b (diff)
downloadtcl-903ca7048a4ab89a4962196a979014681d5db909.zip
tcl-903ca7048a4ab89a4962196a979014681d5db909.tar.gz
tcl-903ca7048a4ab89a4962196a979014681d5db909.tar.bz2
Plug leak. [Bug 1987817]
Diffstat (limited to 'generic')
-rw-r--r--generic/tclOOCall.c22
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);