Fix: ds_file_munmap must check ds_file for NULL
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Sat, 27 May 2017 18:44:06 +0000 (14:44 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Sun, 28 May 2017 16:57:45 +0000 (12:57 -0400)
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 <jeremie.galarneau@efficios.com>
plugins/ctf/fs-src/data-stream-file.c

index 2859ffbe2bd9d01e7ce62b4548922cbe9fec4b04..94f2b9b3edfb1c563eaeb4d35801a71b5cd2cf89 100644 (file)
@@ -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,
This page took 0.025997 seconds and 4 git commands to generate.