From: Julien Desfossez Date: Wed, 28 Mar 2012 02:15:47 +0000 (-0400) Subject: Safety check in iostream X-Git-Tag: v0.2~46 X-Git-Url: https://git.lttng.org/?p=lttngtop.git;a=commitdiff_plain;h=6f29d91efdaccdce256eb2e35be385da599daa77 Safety check in iostream Caused a segfault on a test trace Signed-off-by: Julien Desfossez --- 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;