diff options
| author | Connor E <38229097+c-edw@users.noreply.github.com> | 2019-01-18 13:45:34 +0000 |
|---|---|---|
| committer | Connor E <38229097+c-edw@users.noreply.github.com> | 2019-01-18 13:45:34 +0000 |
| commit | 7c0ba8919712a1e23eca4b4785ab9f30f9e49a7e (patch) | |
| tree | d64550b7a22a786155afc2b337a42a9393da51fc /pango.c | |
| parent | 291bae1e4426e698e29e31e819ebb6b2b5f02e23 (diff) | |
Handle alloc failures.
Diffstat (limited to 'pango.c')
| -rw-r--r-- | pango.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -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); |
