$NetBSD$

-- ./generic/tclCmdIL.c.orig  2010-12-27 00:01:07.000000000 +0000
+++ ./generic/tclCmdIL.c
@@ -3769,7 +3769,7 @@
             break;
         default:
             sortInfo.indexv =
-		    TclStackAlloc(interp, sizeof(int) * sortInfo.indexc);
+		    ckalloc(sizeof(int) * sortInfo.indexc);
             allocatedIndexVector = 1;	/* Cannot use indexc field, as it
                                          * might be decreased by 1 later. */
         }
@@ -3901,7 +3901,7 @@
      * begins sorting it into the sublists as it appears.
      */
 
-    elementArray = TclStackAlloc(interp, length * sizeof(SortElement));
+    elementArray = ckalloc(length * sizeof(SortElement));
 
     for (i=0; i < length; i++){
 	idx = groupSize * i + groupOffset;
@@ -4025,7 +4025,7 @@
     }
 
   done1:
-    TclStackFree(interp, elementArray);
+    ckfree(elementArray);
 
   done:
     if (sortInfo.sortMode == SORTMODE_COMMAND) {
@@ -4035,7 +4035,7 @@
     }
   done2:
     if (allocatedIndexVector) {
-	TclStackFree(interp, sortInfo.indexv);
+	ckfree(sortInfo.indexv);
     }
     return sortInfo.resultCode;
 }
