From ab9de1b30e760993f6f0c34c28fc0eb8c0e59c00 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Mon, 18 Nov 2019 19:57:39 +0000 Subject: allow wpactrl_end() when the wpactrl_t is ZERO as well --- src/libwpactrl/wpactrl_end.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/libwpactrl/wpactrl_end.c b/src/libwpactrl/wpactrl_end.c index 41ea81a..0dbe98b 100644 --- a/src/libwpactrl/wpactrl_end.c +++ b/src/libwpactrl/wpactrl_end.c @@ -8,14 +8,17 @@ void wpactrl_end (wpactrl_t *a) { - a->clientpath.s[a->clientpath.len - 2] = 's' ; - unlink_void(a->clientpath.s) ; - a->clientpath.s[a->clientpath.len - 2] = 'a' ; - unlink_void(a->clientpath.s) ; + if (a->clientpath.s) + { + a->clientpath.s[a->clientpath.len - 2] = 's' ; + unlink_void(a->clientpath.s) ; + a->clientpath.s[a->clientpath.len - 2] = 'a' ; + unlink_void(a->clientpath.s) ; + stralloc_free(&a->clientpath) ; + } fd_close(a->fda) ; fd_close(a->fds) ; stralloc_free(&a->filters) ; stralloc_free(&a->data) ; - stralloc_free(&a->clientpath) ; *a = wpactrl_zero ; } -- cgit v1.2.3