Patchwork P2P: Fix some memory leaks

login
register
mail settings
Submitter Masashi Honma
Date Jan. 8, 2013, 11:50 a.m.
Message ID <CAFk-A4motC2wkDKnoU+XmZAuWHXGZQSF08jx5-K=qc2iTNV9Pw@mail.gmail.com>
Download mbox | patch
Permalink /patch/210348/
State Accepted
Commit f96c1d76fd658ca24ffbd3474df82f67558dc56d
Headers show

Comments

Masashi Honma - Jan. 8, 2013, 11:50 a.m.
This patch fixes some memory leaks in p2p_add_device().

Signed-hostap: Masashi Honma <masashi.honma@gmail.com>


@@ -648,8 +649,10 @@ int p2p_add_device(struct p2p_data *p2p, const u8
*addr, int freq,
 	 * entry is newer than the one previously stored.
 	 */
 	if (dev->last_seen.usec > 0 &&
-	    os_time_before(&entry_ts, &dev->last_seen))
+	    os_time_before(&entry_ts, &dev->last_seen)) {
+		p2p_parse_free(&msg);
 		return -1;
+	}

 	os_memcpy(&dev->last_seen, &entry_ts, sizeof(struct os_time));


Regards,
Masashi Honma.
Jouni Malinen - Jan. 12, 2013, 8:31 a.m.
On Tue, Jan 08, 2013 at 08:50:14PM +0900, Masashi Honma wrote:
> This patch fixes some memory leaks in p2p_add_device().

Thanks! Applied.

Patch

diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c
index 4a09b84..b994a44 100644
--- a/src/p2p/p2p.c
+++ b/src/p2p/p2p.c
@@ -629,6 +629,7 @@  int p2p_add_device(struct p2p_data *p2p, const u8
*addr, int freq,
 		wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Do not add peer "
 			"filter for " MACSTR " due to peer filter",
 			MAC2STR(p2p_dev_addr));
+		p2p_parse_free(&msg);
 		return 0;
 	}