From d238196d1f1b84c98b3a2b8ca49ea83607eb2e9d Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Sat, 27 May 2017 14:44:06 -0400 Subject: [PATCH] Fix: ds_file_munmap must check ds_file for NULL MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit ds_file_munmap may be called with a NULL file in ctf_fs_ds_file_create()'s error path. Signed-off-by: Jérémie Galarneau --- plugins/ctf/fs-src/data-stream-file.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/ctf/fs-src/data-stream-file.c b/plugins/ctf/fs-src/data-stream-file.c index 2859ffbe..94f2b9b3 100644 --- a/plugins/ctf/fs-src/data-stream-file.c +++ b/plugins/ctf/fs-src/data-stream-file.c @@ -56,12 +56,13 @@ static int ds_file_munmap(struct ctf_fs_ds_file *ds_file) { int ret = 0; - struct ctf_fs_component *ctf_fs = ds_file->file->ctf_fs; + struct ctf_fs_component *ctf_fs; - if (!ds_file->mmap_addr) { + if (!ds_file || !ds_file->mmap_addr) { goto end; } + ctf_fs = ds_file->file->ctf_fs; if (munmap(ds_file->mmap_addr, ds_file->mmap_len)) { PERR("Cannot memory-unmap address %p (size %zu) of file \"%s\" (%p): %s\n", ds_file->mmap_addr, ds_file->mmap_len, -- 2.34.1