In case of invalid IO, read_watch is not reset. Fix crash on destroy gatmux.
Signed-off-by: Antoine Aubert <[email protected]> --- gatchat/gatmux.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/gatchat/gatmux.c b/gatchat/gatmux.c index 9beeece..896ddff 100644 --- a/gatchat/gatmux.c +++ b/gatchat/gatmux.c @@ -186,8 +186,10 @@ static gboolean received_data(GIOChannel *channel, GIOCondition cond, GIOStatus status; gsize bytes_read; - if (cond & G_IO_NVAL) + if (cond & G_IO_NVAL) { + mux->read_watch = 0; return FALSE; + } debug(mux, "received data"); @@ -223,14 +225,20 @@ static gboolean received_data(GIOChannel *channel, GIOCondition cond, } } - if (cond & (G_IO_HUP | G_IO_ERR)) + if (cond & (G_IO_HUP | G_IO_ERR)) { + mux->read_watch = 0; return FALSE; + } - if (status != G_IO_STATUS_NORMAL && status != G_IO_STATUS_AGAIN) + if (status != G_IO_STATUS_NORMAL && status != G_IO_STATUS_AGAIN) { + mux->read_watch = 0; return FALSE; + } - if (mux->buf_used == sizeof(mux->buf)) + if (mux->buf_used == sizeof(mux->buf)) { + mux->read_watch = 0; return FALSE; + } return TRUE; } -- 2.7.4
_______________________________________________ ofono mailing list [email protected] https://lists.ofono.org/mailman/listinfo/ofono
