summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--generic/ttk/ttkTheme.c6
2 files changed, 7 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index e7a4cdc..b405c97 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2009-03-25 Donal K. Fellows <dkf@users.sf.net>
+ * generic/ttk/ttkTheme.c (BuildOptionMap, NewElementImpl):
+ [Bug 2178820]: Ensure that zero-size allocations don't happen; some
+ malloc implementations don't like it at all.
+
* win/wish.exe.manifest.in: [Bug 1871101]: Add magic to make Tk not be
blurred on Vista with large fonts.
diff --git a/generic/ttk/ttkTheme.c b/generic/ttk/ttkTheme.c
index 598bc34..04dab19 100644
--- a/generic/ttk/ttkTheme.c
+++ b/generic/ttk/ttkTheme.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.
*
- * $Id: ttkTheme.c,v 1.11 2007/12/13 15:26:26 dgp Exp $
+ * $Id: ttkTheme.c,v 1.11.2.1 2009/03/25 09:10:04 dkf Exp $
*/
#include <stdlib.h>
@@ -186,7 +186,7 @@ static OptionMap
BuildOptionMap(ElementImpl *elementImpl, Tk_OptionTable optionTable)
{
OptionMap optionMap = (OptionMap)ckalloc(
- sizeof(const Tk_OptionSpec) * elementImpl->nResources);
+ sizeof(const Tk_OptionSpec) * elementImpl->nResources + 1);
int i;
for (i = 0; i < elementImpl->nResources; ++i) {
@@ -244,7 +244,7 @@ NewElementImpl(const char *name, Ttk_ElementSpec *specPtr,void *clientData)
/* Initialize default values:
*/
elementImpl->defaultValues = (Tcl_Obj**)
- ckalloc(elementImpl->nResources * sizeof(Tcl_Obj *));
+ ckalloc(elementImpl->nResources * sizeof(Tcl_Obj *) + 1);
for (i=0; i < elementImpl->nResources; ++i) {
const char *defaultValue = specPtr->options[i].defaultValue;
if (defaultValue) {