Ticket #52281: patch-camel_camel-folder-thread.c.diff
File patch-camel_camel-folder-thread.c.diff, 937 bytes (added by gwhitney, 8 years ago) |
---|
-
camel/camel-folder-thread.c
old new 425 425 return 1; 426 426 } 427 427 428 #define MAX_ALLOCA_CHILDREN 1024 429 428 430 static void 429 431 sort_thread (CamelFolderThreadNode **cp) 430 432 { 431 433 CamelFolderThreadNode *c, *head, **carray; 432 434 gint size = 0; 433 435 gboolean need_to_free_carray = FALSE; 436 434 437 c = *cp; 435 438 while (c) { 436 439 /* sort the children while we're at it */ … … 441 444 } 442 445 if (size < 2) 443 446 return; 444 carray = alloca (size * sizeof (CamelFolderThreadNode *)); 447 if (size > MAX_ALLOCA_CHILDREN) { 448 carray = g_new (CamelFolderThreadNode *, size); 449 need_to_free_carray = TRUE; 450 } else { 451 carray = alloca (size * sizeof (CamelFolderThreadNode *)); 452 } 445 453 c = *cp; 446 454 size = 0; 447 455 while (c) { … … 461 469 size--; 462 470 } while (size >= 0); 463 471 *cp = head; 472 if (need_to_free_carray) { 473 g_free (carray); 474 } 464 475 } 465 476 466 477 static guint