Fix: ds_file_munmap must check ds_file for NULL
[babeltrace.git] / 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.024093 seconds and 4 git commands to generate.