aboutsummaryrefslogtreecommitdiffstats
path: root/fm.c
diff options
context:
space:
mode:
Diffstat (limited to 'fm.c')
-rw-r--r--fm.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fm.c b/fm.c
index 3339d9b..ab096ea 100644
--- a/fm.c
+++ b/fm.c
@@ -186,8 +186,10 @@ static char *fm_print_preview_content(window *w, const char *path)
{
char *buf = xmalloc(sizeof(char) * PATH_MAX);
FILE *fp = fopen(path, "r");
- if (!fp)
+ if (!fp) {
+ free(buf);
die("Cannot open file: %s", path);
+ }
int i = 0;
while (fgets(buf, PATH_MAX, fp) != NULL && i < w->height) {