From 8d57c52f2cc62fc31588eb3f9c5fbedd5e4de674 Mon Sep 17 00:00:00 2001 From: Grigori Goronzy Date: Tue, 8 Sep 2015 01:38:44 +0200 Subject: [PATCH] fontselect: handle additional malloc errors --- libass/ass_fontselect.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libass/ass_fontselect.c b/libass/ass_fontselect.c index 2a00c37..7c02373 100644 --- a/libass/ass_fontselect.c +++ b/libass/ass_fontselect.c @@ -1051,9 +1051,12 @@ void ass_map_font(const ASS_FontMapping *map, int len, const char *name, { for (int i = 0; i < len; i++) { if (strcasecmp(map[i].from, name) == 0) { - meta->n_fullname = 1; meta->fullnames = calloc(1, sizeof(char *)); - meta->fullnames[0] = strdup(map[i].to); + if (meta->fullnames) { + meta->fullnames[0] = strdup(map[i].to); + if (meta->fullnames[0]) + meta->n_fullname = 1; + } return; } } -- 2.40.0