summaryrefslogtreecommitdiff
path: root/pango.c
diff options
context:
space:
mode:
Diffstat (limited to 'pango.c')
-rw-r--r--pango.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/pango.c b/pango.c
index f40750b..8e80015 100644
--- a/pango.c
+++ b/pango.c
@@ -94,6 +94,10 @@ PangoLayout *get_pango_layout(cairo_t *cairo, const char *font,
void get_text_size(cairo_t *cairo, const char *font, int *width, int *height,
int *baseline, double scale, bool markup, const char *fmt, ...) {
char *buf = malloc(max_chars);
+ if (buf == NULL) {
+ swaylock_log(LOG_ERROR, "Failed to allocate memory");
+ return;
+ }
va_list args;
va_start(args, fmt);
@@ -116,6 +120,10 @@ void get_text_size(cairo_t *cairo, const char *font, int *width, int *height,
void pango_printf(cairo_t *cairo, const char *font,
double scale, bool markup, const char *fmt, ...) {
char *buf = malloc(max_chars);
+ if (buf == NULL) {
+ swaylock_log(LOG_ERROR, "Failed to allocate memory");
+ return;
+ }
va_list args;
va_start(args, fmt);