From 3a30c034a9f319692c2ba131906e009eaa254817 Mon Sep 17 00:00:00 2001 From: Vinit Deshpande Date: Fri, 11 Dec 2015 13:44:59 -0800 Subject: Fix a potential leak of nl_msg objects It was discovered on other repos that a leak can be caused by repeated usage of create(). Bug: 26116598 Change-Id: Ie6cd318171e58d3ffa1a6c8f58cfa38ea7d78b00 --- bcmdhd/wifi_hal/cpp_bindings.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bcmdhd/wifi_hal/cpp_bindings.cpp b/bcmdhd/wifi_hal/cpp_bindings.cpp index 5b085d8..399199d 100644 --- a/bcmdhd/wifi_hal/cpp_bindings.cpp +++ b/bcmdhd/wifi_hal/cpp_bindings.cpp @@ -538,6 +538,9 @@ int WifiEvent::parse() { } 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, -- cgit v1.1