diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2019-11-18 19:57:39 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2019-11-18 19:57:39 +0000 |
commit | ab9de1b30e760993f6f0c34c28fc0eb8c0e59c00 (patch) | |
tree | 505a1332d2acacaff0de5caf1627fdb9143ed836 /src | |
parent | 0ab9a77f9689dcf99c8b389db375b5cd5be1d8d5 (diff) | |
download | bcnm-ab9de1b30e760993f6f0c34c28fc0eb8c0e59c00.tar.xz |
allow wpactrl_end() when the wpactrl_t is ZERO as well
Diffstat (limited to 'src')
-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 ; } |