From fa07570f76726f918f06f9ad4e3fdb4a799fbe65 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 4 Feb 2018 23:40:27 +0100 Subject: [PATCH] Simplify fill_pathname_representation_wrapper --- file_path_special.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/file_path_special.c b/file_path_special.c index f248a0bc6d..e58d10032f 100644 --- a/file_path_special.c +++ b/file_path_special.c @@ -383,19 +383,18 @@ void fill_pathname_application_special(char *s, void fill_short_pathname_representation_wrapper(char* out_rep, const char *in_path, size_t size) { - char *path_short = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); #ifdef HAVE_COMPRESSION + char *path_short = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); char *last_slash = NULL; -#endif - path_short[0] = '\0'; + path_short[0] = '\0'; fill_pathname(path_short, path_basename(in_path), "", PATH_MAX_LENGTH * sizeof(char) ); -#ifdef HAVE_COMPRESSION last_slash = find_last_slash(path_short); + if (last_slash != NULL) { /* We handle paths like: @@ -410,8 +409,9 @@ void fill_short_pathname_representation_wrapper(char* out_rep, free(path_short); return; } + + free(path_short); #endif fill_short_pathname_representation(out_rep, in_path, size); - free(path_short); }