From 0aef9e96698381f8aac6553fd136579659e00af4 Mon Sep 17 00:00:00 2001 From: Roland Baer Date: Tue, 31 Jul 2007 14:30:07 +0300 Subject: [PATCH] Various NULL checks --- plugins/ini.c | 4 ++++ plugins/scale.c | 3 ++- src/screen.c | 5 +++++ 3 files changed, 11 insertions(+), 1 deletions(-) diff --git a/plugins/ini.c b/plugins/ini.c index f88d1e3..d70416f 100644 --- a/plugins/ini.c +++ b/plugins/ini.c @@ -544,6 +544,10 @@ parseAction (CompDisplay *d, int len = strlen (optionName) - strlen (optionType); char *realOptionName = malloc (sizeof (char) * (len+1)); + if (!realOptionName) { + return FALSE; + } + strncpy (realOptionName, optionName, len); realOptionName[len] = '\0'; diff --git a/plugins/scale.c b/plugins/scale.c index 84b3a26..ad0c86d 100644 --- a/plugins/scale.c +++ b/plugins/scale.c @@ -1404,7 +1404,8 @@ scaleSelectWindow (CompWindow *w) if (old) addWindowDamage (old); - addWindowDamage (new); + if (new) + addWindowDamage (new); } } diff --git a/src/screen.c b/src/screen.c index 15458f7..c62fb09 100644 --- a/src/screen.c +++ b/src/screen.c @@ -464,6 +464,8 @@ setScreenOption (CompScreen *screen, vsize = compFindOption (screen->opt, NUM_OPTIONS (screen), "vsize", NULL); + if (!vsize) + return FALSE; if (!vsize) return FALSE; @@ -486,6 +488,9 @@ setScreenOption (CompScreen *screen, if (!hsize) return FALSE; + if (!hsize) + return FALSE; + if (o->value.i * screen->height > MAXSHORT) return FALSE; -- 1.5.2.3