summaryrefslogtreecommitdiff
path: root/shared
diff options
context:
space:
mode:
authorMarius Vlad <marius.vlad@collabora.com>2022-07-12 14:31:07 +0300
committerMarius Vlad <marius.vlad@collabora.com>2022-11-10 11:07:12 +0200
commit60b307e3ced67caff162714d31f6af1148ddca5e (patch)
tree7a63914a322e3e86c3848d97f208983c2cbb9209 /shared
parentf8a9ce3f5588fc7a053fbbd7efee8d11811f333d (diff)
downloadweston-60b307e3ced67caff162714d31f6af1148ddca5e.tar.gz
shared/cairo-util: Zero out the memory when creating a new theme
Having the memory zeroed out just works better and avoids any possible illegal access. Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Diffstat (limited to 'shared')
-rw-r--r--shared/cairo-util.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/shared/cairo-util.c b/shared/cairo-util.c
index 29553b9e..728ba471 100644
--- a/shared/cairo-util.c
+++ b/shared/cairo-util.c
@@ -37,6 +37,7 @@
#include "shared/helpers.h"
#include "image-loader.h"
+#include "shared/xalloc.h"
#include <libweston/config-parser.h>
#ifdef HAVE_PANGO
@@ -419,9 +420,7 @@ theme_create(void)
struct theme *t;
cairo_t *cr;
- t = malloc(sizeof *t);
- if (t == NULL)
- return NULL;
+ t = xzalloc(sizeof *t);
t->margin = 32;
t->width = 6;