From 6c6e28e3539a92cf5d946775bbeb5133046bfa50 Mon Sep 17 00:00:00 2001 From: Can Alkan Date: Fri, 10 May 2019 11:40:57 +0300 Subject: [PATCH] prefix bug fixed --- common.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/common.c b/common.c index 9910596..e20fadf 100644 --- a/common.c +++ b/common.c @@ -520,8 +520,9 @@ void get_working_directory(parameters *params){ directory = strrchr(params->outprefix, '/'); prefix = NULL; - set_str( &prefix, directory + 1); - if ( debug_mode) + if (directory != NULL) + set_str( &prefix, directory + 1); + if ( debug_mode && prefix != NULL) fprintf (stderr, "prefix: %s\n", prefix); if (directory == NULL){ @@ -539,13 +540,15 @@ void get_working_directory(parameters *params){ params->outdir[i]='/'; params->outdir[i+1] = 0; - free( params->outprefix); - params->outprefix = NULL; - if ( debug_mode) + if ( debug_mode && prefix != NULL) fprintf (stderr, "prefix2: %s\n", prefix); - - set_str( &(params->outprefix), prefix); - free (prefix); + + if (prefix!=NULL){ + free( params->outprefix); + params->outprefix = NULL; + set_str( &(params->outprefix), prefix); + free (prefix); + } } char *get_file_name(char *path)