mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-03 10:04:32 +03:00
Fix for the previous patch to avoid freeing bogus pointers.
This commit is contained in:
parent
f0a33821e6
commit
c799424167
@ -592,11 +592,12 @@ 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);
|
||||
close_view_file (view);
|
||||
return init_growing_view (view, 0, view->filename);
|
||||
|
Loading…
Reference in New Issue
Block a user