diff options
author | dkf <dkf@noemail.net> | 2009-03-25 09:06:57 (GMT) |
---|---|---|
committer | dkf <dkf@noemail.net> | 2009-03-25 09:06:57 (GMT) |
commit | 3ec1915d9882b60ed59ca41d27b14b6a74ce2e52 (patch) | |
tree | a954daab606c8455e8c20c342a0f9366c725602b /generic | |
parent | 51d2593b05fb2cc14101c020bb8ce40860edf0bc (diff) | |
download | tk-3ec1915d9882b60ed59ca41d27b14b6a74ce2e52.zip tk-3ec1915d9882b60ed59ca41d27b14b6a74ce2e52.tar.gz tk-3ec1915d9882b60ed59ca41d27b14b6a74ce2e52.tar.bz2 |
Prevent zero-size malloc() calls. [Bug 2178820]
FossilOrigin-Name: ddd898d0a3c19c7df5dc1f7651c60623411c506c
Diffstat (limited to 'generic')
-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 9787b4b..e19ca20 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.18 2009/02/08 19:35:35 jenglish Exp $ + * $Id: ttkTheme.c,v 1.19 2009/03/25 09:06:58 dkf Exp $ */ #include <stdlib.h> @@ -182,7 +182,7 @@ static OptionMap BuildOptionMap(Ttk_ElementClass *elementClass, Tk_OptionTable optionTable) { OptionMap optionMap = (OptionMap)ckalloc( - sizeof(const Tk_OptionSpec) * elementClass->nResources); + sizeof(const Tk_OptionSpec) * elementClass->nResources + 1); int i; for (i = 0; i < elementClass->nResources; ++i) { @@ -241,7 +241,7 @@ NewElementClass(const char *name, Ttk_ElementSpec *specPtr,void *clientData) /* Initialize default values: */ elementClass->defaultValues = (Tcl_Obj**) - ckalloc(elementClass->nResources * sizeof(Tcl_Obj *)); + ckalloc(elementClass->nResources * sizeof(Tcl_Obj *) + 1); for (i=0; i < elementClass->nResources; ++i) { const char *defaultValue = specPtr->options[i].defaultValue; if (defaultValue) { |