Safety check in iostream
authorJulien Desfossez <julien.desfossez@efficios.com>
Wed, 28 Mar 2012 02:15:47 +0000 (22:15 -0400)
committerJulien Desfossez <julien.desfossez@efficios.com>
Wed, 28 Mar 2012 02:15:47 +0000 (22:15 -0400)
Caused a segfault on a test trace

Signed-off-by: Julien Desfossez <julien.desfossez@efficios.com>
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.023793 seconds and 4 git commands to generate.