From 9e8866ae20b0999b54fda9a52644ac937fedc0a1 Mon Sep 17 00:00:00 2001 From: Hugo Osvaldo Barrera Date: Wed, 29 Jun 2022 21:35:21 +0200 Subject: [PATCH] Avoid unecessary string copy --- sway/commands/font.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sway/commands/font.c b/sway/commands/font.c index cea720f50..3eda0a9c6 100644 --- a/sway/commands/font.c +++ b/sway/commands/font.c @@ -16,12 +16,12 @@ struct cmd_results *cmd_font(int argc, char **argv) { if (strncmp(font, "pango:", 6) == 0) { config->pango_markup = true; config->font = strdup(font + 6); + free(font); } else { config->pango_markup = false; - config->font = strdup(font); + config->font = font; } - free(font); config_update_font_height(); return cmd_results_new(CMD_SUCCESS, NULL); }