From ba57c061ae0ade749701214e582455c952886d32 Mon Sep 17 00:00:00 2001 From: "Alfred E. Heggestad" Date: Tue, 19 Jul 2016 21:03:31 +0200 Subject: stream: don't access stream object after calling error-handler --- src/stream.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/stream.c b/src/stream.c index 9250fe2..24721d2 100644 --- a/src/stream.c +++ b/src/stream.c @@ -18,11 +18,13 @@ enum { static void stream_close(struct stream *strm, int err) { + stream_error_h *errorh = strm->errorh; + strm->terminated = true; + strm->errorh = NULL; - if (strm->errorh) { - strm->errorh(strm, err, strm->errorh_arg); - strm->errorh = NULL; + if (errorh) { + errorh(strm, err, strm->errorh_arg); } } -- cgit v1.2.3