From f5af9781181bb07796b1eec7fbaf27c705d73484 Mon Sep 17 00:00:00 2001 From: PolynomialDivision Date: Sat, 26 Aug 2017 00:15:28 +0200 Subject: [PATCH] Lock probe_get --- src/storage/datastorage.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/storage/datastorage.c b/src/storage/datastorage.c index a3115fb..64a82c1 100644 --- a/src/storage/datastorage.c +++ b/src/storage/datastorage.c @@ -307,6 +307,7 @@ probe_entry probe_array_delete(probe_entry entry) { } probe_entry probe_array_get_entry(uint8_t bssid_addr[], uint8_t client_addr[]) { + int i; probe_entry tmp; @@ -314,6 +315,7 @@ probe_entry probe_array_get_entry(uint8_t bssid_addr[], uint8_t client_addr[]) { return tmp; } + pthread_mutex_lock(&probe_array_mutex); for (i = 0; i <= probe_entry_last; i++) { if (mac_is_equal(bssid_addr, probe_array[i].bssid_addr) && mac_is_equal(client_addr, probe_array[i].client_addr)) { @@ -321,6 +323,8 @@ probe_entry probe_array_get_entry(uint8_t bssid_addr[], uint8_t client_addr[]) { break; } } + pthread_mutex_unlock(&probe_array_mutex); + return tmp; }