diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2009-03-25 09:10:04 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2009-03-25 09:10:04 (GMT) |
commit | 8a9c07bdeeda15aec006355463bc11c8327c4cee (patch) | |
tree | c8b1abc8caf5d76271c8345b11be06abafa62927 /generic/ttk | |
parent | c6fa7c4a7e2b20de2e9724bf0c5e1ebe659b9d1a (diff) | |
download | tk-8a9c07bdeeda15aec006355463bc11c8327c4cee.zip tk-8a9c07bdeeda15aec006355463bc11c8327c4cee.tar.gz tk-8a9c07bdeeda15aec006355463bc11c8327c4cee.tar.bz2 |
Prevent zero-size malloc() calls. [Bug 2178820]
Diffstat (limited to 'generic/ttk')
-rw-r--r-- | generic/ttk/ttkTheme.c | 6 |
1 files changed, 3 insertions, 3 deletions
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) { |