From 7b88557ef5eb080cd4c957025ef6b0bebf16d460 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Mon, 16 Sep 2019 16:55:03 +0200 Subject: [PATCH] tweaks: meld two calls of free() into a single one, to elide an 'else' --- src/color.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/color.c b/src/color.c index 5b0e05fc..ac401e59 100644 --- a/src/color.c +++ b/src/color.c @@ -197,14 +197,11 @@ void color_update(void) char *joinednames = charalloc(PATH_MAX + 1); char *fullname = NULL; - if (currentdir == NULL) - free(reserved); - else { + if (currentdir != NULL) { /* Concatenate the current working directory with the * specified filename, and canonicalize the result. */ sprintf(joinednames, "%s/%s", currentdir, openfile->filename); fullname = get_full_path(joinednames); - free(currentdir); } if (fullname == NULL) @@ -217,6 +214,7 @@ void color_update(void) free(joinednames); free(fullname); + free(reserved); } /* If the filename didn't match anything, try the first line. */