summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--util.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/util.c b/util.c
index bbc8ea9..5471129 100644
--- a/util.c
+++ b/util.c
@@ -506,13 +506,14 @@ ResolveName(char *filename)
if (result == NULL && errno == ENOENT) {
int length;
- char *dir, *file;
+ char *dir, *file, *fname;
length = strlen(filename);
tmp = dir = XtMalloc(length + 1);
strcpy(dir, filename);
+ fname = strdup(filename);
- file = basename(filename);
+ file = basename(fname);
dir = dirname(tmp);
/* Creating a new file? */
@@ -526,6 +527,7 @@ ResolveName(char *filename)
}
XtFree(tmp);
+ free(fname);
}
return (result);