p2p: use calloc to ensure the zero-terminator
The fequency parameter of scan function is a list.
The last one must be zere to indicate the end of the list.
Bug: 130624119
Test: CtsVerifier - WiFi Direct fixed frequency test
Change-Id: Ic25a95cec97ffa1be755e81d233c1aac3b3a4634
diff --git a/wpa_supplicant/hidl/1.2/p2p_iface.cpp b/wpa_supplicant/hidl/1.2/p2p_iface.cpp
index 7acb0d3..7dddee9 100644
--- a/wpa_supplicant/hidl/1.2/p2p_iface.cpp
+++ b/wpa_supplicant/hidl/1.2/p2p_iface.cpp
@@ -265,7 +265,11 @@
return -1;
}
- params.freqs = (int *) os_malloc(sizeof(int) * 2);
+ /*
+ * Allocate memory for frequency array, allocate one extra
+ * slot for the zero-terminator.
+ */
+ params.freqs = (int *) os_calloc(2, sizeof(int));
if (params.freqs) {
params.freqs[0] = freq;
} else {