diff options
-rw-r--r-- | src/libwpactrl/wpactrl_end.c | 13 |
1 files changed, 8 insertions, 5 deletions
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 ; } |