]> granicus.if.org Git - libass/commitdiff
fontselect: handle additional malloc errors
authorGrigori Goronzy <greg@chown.ath.cx>
Mon, 7 Sep 2015 23:38:44 +0000 (01:38 +0200)
committerGrigori Goronzy <greg@chown.ath.cx>
Mon, 7 Sep 2015 23:38:44 +0000 (01:38 +0200)
libass/ass_fontselect.c

index 2a00c376bdd562ec7cbd3e4839ebc26865fda0ff..7c023734a0efe948ec38efb3a82f69e217931276 100644 (file)
@@ -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;
         }
     }