Safety check in iostream
[lttngtop.git] / src / iostreamtop.c
index 62b926ecb76de51934a864292153d19d582217d8..7c1d611af8b74b1a7e6aa1ac566b2fbc5c8b52ad 100644 (file)
@@ -199,13 +199,15 @@ int update_iostream_ret(struct lttngtop *ctx, int tid, char *comm,
                        tmp->totalfileread += ret;
                        tmp->fileread += ret;
                        tmpfile = get_file(tmp, tmp->syscall_info->fd);
-                       tmpfile->read += ret;
+                       if (tmpfile)
+                               tmpfile->read += ret;
                } else if (tmp->syscall_info->type == __NR_write
                        && ret > 0) {
                        tmp->totalfilewrite += ret;
                        tmp->filewrite += ret;
                        tmpfile = get_file(tmp, tmp->syscall_info->fd);
-                       tmpfile->write += ret;
+                       if (tmpfile)
+                               tmpfile->write += ret;
                } else if (tmp->syscall_info->type == __NR_open
                        && ret > 0) {
                        tmpfile = tmp->files_history->file;
This page took 0.022488 seconds and 4 git commands to generate.