diff options
-rw-r--r-- | srcpos.c | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -86,6 +86,16 @@ struct dtc_file *dtc_open_file(const char *fname, return file; } + if (fname[0] == '/') { + file->file = fopen(fname, "r"); + + if (!file->file) + goto out; + + file->name = strdup(fname); + return file; + } + if (!search) search = &default_search; @@ -100,6 +110,7 @@ struct dtc_file *dtc_open_file(const char *fname, } out: + free((void *)file->dir); free(file); return NULL; } @@ -109,5 +120,6 @@ void dtc_close_file(struct dtc_file *file) if (fclose(file->file)) die("Error closing \"%s\": %s\n", file->name, strerror(errno)); + free((void *)file->dir); free(file); } |