Check the service pointer on aidl deinit to avoid
a possible segfault.
Bug: 218900981
Test: adb root
adb shell
/vendor/bin/hw/hostapd -i wlan0 -B /data/sigma_dut-ap.conf
# Should terminate with no output.
Change-Id: I5b814e2bd7539f41136b9de00161eee2301e8d51
diff --git a/hostapd/aidl/aidl.cpp b/hostapd/aidl/aidl.cpp
index 68a7714..e02708c 100644
--- a/hostapd/aidl/aidl.cpp
+++ b/hostapd/aidl/aidl.cpp
@@ -64,8 +64,10 @@
void hostapd_aidl_deinit(struct hapd_interfaces *interfaces)
{
wpa_printf(MSG_INFO, "Deiniting aidl control");
- // Before aidl init, make sure call terminate to clear callback_
- service->terminate();
+ // Before aidl deinit, make sure call terminate to clear callback_
+ if (service) {
+ service->terminate();
+ }
eloop_unregister_read_sock(aidl_fd);
aidl_fd = -1;
}