summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@redhat.com>2008-12-01 11:10:52 +1000
committerPeter Hutterer <peter.hutterer@redhat.com>2008-12-01 11:51:50 +1000
commit4c3f466f67a7819a912a736f4f2a97262bdaf589 (patch)
tree5ea842f2f022cdae13a0e47b2e79d0a67b51b99a
parent3ba7cfd701d99b4b1fe1dd7eecd02d01c1dee74c (diff)
Check return value of calloc and realloc. #18759 and #18760
X.Org Bug <http://bugs.freedesktop.org/show_bug.cgi?id=18759> X.Org Bug <http://bugs.freedesktop.org/show_bug.cgi?id=18760> Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
-rw-r--r--setxkbmap.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/setxkbmap.c b/setxkbmap.c
index 4f65454..5e906cd 100644
--- a/setxkbmap.c
+++ b/setxkbmap.c
@@ -666,11 +666,21 @@ stringFromOptions(char *orig, int numNew, char **newOpts)
if (orig)
{
orig = (char *) realloc(orig, len);
+ if (!orig)
+ {
+ ERR("OOM in stringFromOptions\n");
+ return NULL;
+ }
nOut = 1;
}
else
{
orig = (char *) calloc(len, 1);
+ if (!orig)
+ {
+ ERR("OOM in stringFromOptions\n");
+ return NULL;
+ }
nOut = 0;
}
for (i = 0; i < numNew; i++)