Fix leaked nl_msg objects
Colin (ccross@google.com) found out that create() gets
called on same object multiple times; without a call to
destroy() in between; this causes leaks.
This change will destroy the request object, before allowing
create to proceed.
BUG: 25392275
Change-Id: Id2199346020dd69f735f50fe3b2f11bfe251cad0
diff --git a/qcwcn/wifi_hal/cpp_bindings.cpp b/qcwcn/wifi_hal/cpp_bindings.cpp
index 381d8c8..99fb26b 100644
--- a/qcwcn/wifi_hal/cpp_bindings.cpp
+++ b/qcwcn/wifi_hal/cpp_bindings.cpp
@@ -556,6 +556,9 @@
}
int WifiRequest::create(int family, uint8_t cmd, int flags, int hdrlen) {
+
+ destroy();
+
mMsg = nlmsg_alloc();
if (mMsg != NULL) {
genlmsg_put(mMsg, /* pid = */ 0, /* seq = */ 0, family,