In unwind part of tcb finalization, tcp->s_ent
was accessed to decide whether pending stacktrace in tcp->queue
should be printed or not.

However, s_ent can be NULL if invalid pid is given to strace
as an trace target. Here invalid pid means that the pid is
not associated with any process.

This patch handles such case.

Signed-off-by: Masatake YAMATO <[email protected]>
---
 unwind.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/unwind.c b/unwind.c
index ed2d141..a7e985e 100644
--- a/unwind.c
+++ b/unwind.c
@@ -572,7 +572,7 @@ unwind_tcb_init(struct tcb *tcp)
 void
 unwind_tcb_fin(struct tcb *tcp)
 {
-       if (tcp->s_ent->sys_flags & STACKTRACE_CAPTURE_IN_ENTERING)
+       if ((tcp->s_ent != NULL) && (tcp->s_ent->sys_flags & 
STACKTRACE_CAPTURE_IN_ENTERING))
                queue_print_and_free(tcp);
        else
                queue_free(tcp->queue, NULL);
-- 
1.8.5.3


------------------------------------------------------------------------------
Put Bad Developers to Shame
Dominate Development with Jenkins Continuous Integration
Continuously Automate Build, Test & Deployment 
Start a new project now. Try Jenkins in the cloud.
http://p.sf.net/sfu/13600_Cloudbees
_______________________________________________
Strace-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/strace-devel

Reply via email to