summaryrefslogtreecommitdiffstats
path: root/generic/ttk
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2009-03-25 09:10:04 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2009-03-25 09:10:04 (GMT)
commit2bc412bce298c5df68991269aa88483ad158e108 (patch)
treec8b1abc8caf5d76271c8345b11be06abafa62927 /generic/ttk
parentb538cddb15fe7c5adca98283566bdd359126e08a (diff)
downloadtk-2bc412bce298c5df68991269aa88483ad158e108.zip
tk-2bc412bce298c5df68991269aa88483ad158e108.tar.gz
tk-2bc412bce298c5df68991269aa88483ad158e108.tar.bz2
Prevent zero-size malloc() calls. [Bug 2178820]
Diffstat (limited to 'generic/ttk')
-rw-r--r--generic/ttk/ttkTheme.c6
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) {