summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2019-11-18 19:57:39 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2019-11-18 19:57:39 +0000
commitab9de1b30e760993f6f0c34c28fc0eb8c0e59c00 (patch)
tree505a1332d2acacaff0de5caf1627fdb9143ed836 /src
parent0ab9a77f9689dcf99c8b389db375b5cd5be1d8d5 (diff)
downloadbcnm-ab9de1b30e760993f6f0c34c28fc0eb8c0e59c00.tar.gz
bcnm-ab9de1b30e760993f6f0c34c28fc0eb8c0e59c00.tar.xz
bcnm-ab9de1b30e760993f6f0c34c28fc0eb8c0e59c00.zip
allow wpactrl_end() when the wpactrl_t is ZERO as well
Diffstat (limited to 'src')
-rw-r--r--src/libwpactrl/wpactrl_end.c13
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 ;
 }