From d6bb9af645526a810512eaf2c65252ac0e0e6b36 Mon Sep 17 00:00:00 2001 From: Grigori Goronzy Date: Mon, 7 Sep 2015 11:06:17 +0200 Subject: fontselect: get rid of strdup for display name The name is always pulled from the font info, which is static, so there is no need to strdup. --- libass/ass_font.c | 5 ----- libass/ass_fontselect.c | 6 +++--- 2 files changed, 3 insertions(+), 8 deletions(-) (limited to 'libass') diff --git a/libass/ass_font.c b/libass/ass_font.c index 0164b67..b3c639d 100644 --- a/libass/ass_font.c +++ b/libass/ass_font.c @@ -153,7 +153,6 @@ static int add_face(ASS_FontSelector *fontsel, ASS_Font *font, uint32_t ch) if (font->faces_uid[i] == uid) { ass_msg(font->library, MSGL_INFO, "Got a font face that already is available! Skipping."); - free(path); return i; } } @@ -178,7 +177,6 @@ static int add_face(ASS_FontSelector *fontsel, ASS_Font *font, uint32_t ch) if (error) { ass_msg(font->library, MSGL_WARN, "Error opening memory font: '%s'", path); - free(path); return -1; } @@ -187,7 +185,6 @@ static int add_face(ASS_FontSelector *fontsel, ASS_Font *font, uint32_t ch) if (error) { ass_msg(font->library, MSGL_WARN, "Error opening font: '%s', %d", path, index); - free(path); return -1; } @@ -201,7 +198,6 @@ static int add_face(ASS_FontSelector *fontsel, ASS_Font *font, uint32_t ch) if (error) { ass_msg(font->library, MSGL_WARN, "Error opening font: '%s', %d", path, i); - free(path); return -1; } @@ -217,7 +213,6 @@ static int add_face(ASS_FontSelector *fontsel, ASS_Font *font, uint32_t ch) font->faces[font->n_faces] = face; font->faces_uid[font->n_faces++] = uid; ass_face_set_size(face, font->size); - free(path); return font->n_faces - 1; } diff --git a/libass/ass_fontselect.c b/libass/ass_fontselect.c index 2be6549..d48b170 100644 --- a/libass/ass_fontselect.c +++ b/libass/ass_fontselect.c @@ -564,11 +564,11 @@ find_font(ASS_FontSelector *priv, ASS_Library *library, // used for display purposes so it doesn't matter that much, // though. if (selected->postscript_name) - result = strdup(selected->postscript_name); + result = selected->postscript_name; else - result = strdup(selected->families[0]); + result = selected->families[0]; } else - result = strdup(selected->path); + result = selected->path; } return result; -- cgit v1.2.3