From c799424167b6aaff3d3b0f870639f7956fa0f7e0 Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Wed, 26 Feb 2003 19:25:13 +0000 Subject: [PATCH] Fix for the previous patch to avoid freeing bogus pointers. --- src/view.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/view.c b/src/view.c index 168dfec71..507141a01 100644 --- a/src/view.c +++ b/src/view.c @@ -592,12 +592,13 @@ load_view_file (WView *view, int fd) /* Make sure view->s.st_size is not truncated when passed to g_malloc */ if ((gulong) view->s.st_size == view->s.st_size) view->data = (unsigned char *) g_malloc ((gulong) view->s.st_size); + else + view->data = NULL; if (view->data == NULL || mc_lseek (view->file, 0, SEEK_SET) != 0 || mc_read (view->file, view->data, view->s.st_size) != view->s.st_size) { - if (view->data != NULL) - g_free (view->data); + g_free (view->data); close_view_file (view); return init_growing_view (view, 0, view->filename); }