malloc null check

This commit is contained in:
Kwon-Young Choi 2022-05-04 08:33:33 +02:00
parent 6876138c5a
commit 53dde33e20

View file

@ -4051,6 +4051,9 @@ _cairo_svg_surface_show_text_glyphs_impl (cairo_svg_stream_t *output,
return status;
}
char * utf8_str = _cairo_malloc_ab(utf8_len + 1, sizeof(char));
if (unlikely (utf8_str == NULL)) {
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
}
strncpy(utf8_str, utf8, utf8_len);
utf8_str[utf8_len] = '\0';
_cairo_svg_stream_printf (output,