From 6f29d91efdaccdce256eb2e35be385da599daa77 Mon Sep 17 00:00:00 2001 From: Julien Desfossez Date: Tue, 27 Mar 2012 22:15:47 -0400 Subject: [PATCH] Safety check in iostream Caused a segfault on a test trace Signed-off-by: Julien Desfossez --- src/iostreamtop.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/iostreamtop.c b/src/iostreamtop.c index 62b926e..7c1d611 100644 --- a/src/iostreamtop.c +++ b/src/iostreamtop.c @@ -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; -- 2.34.1