From 8784c67d35e2d95902fb17cd799abaf132b416a9 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Fri, 10 May 2019 11:22:11 +0300 Subject: [PATCH] a2dp: Fix memory when loading of LastUsed fails This fixes the following trace: 3 bytes in 1 blocks are definitely lost in loss record 2 of 246 at 0x483880B: malloc (vg_replace_malloc.c:309) by 0x491BDC5: g_malloc (in /usr/lib64/libglib-2.0.so.0.5800.3) by 0x490CF2B: ??? (in /usr/lib64/libglib-2.0.so.0.5800.3) by 0x490E7CF: g_key_file_get_string (in /usr/lib64/libglib-2.0.so.0.5800.3) by 0x41E85B: load_remote_sep (a2dp.c:1987) by 0x41E85B: load_remote_seps (a2dp.c:2030) by 0x41EC86: avdtp_state_cb (a2dp.c:2053) by 0x421F77: avdtp_set_state (avdtp.c:700) by 0x42818B: avdtp_connect_cb (avdtp.c:2313) by 0x42847C: avdtp_new (avdtp.c:2389) by 0x41B4BB: connect_cb (a2dp.c:2145) by 0x46D993: accept_cb (btio.c:203) --- profiles/audio/a2dp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/profiles/audio/a2dp.c b/profiles/audio/a2dp.c index 046193688..f98ec8505 100644 --- a/profiles/audio/a2dp.c +++ b/profiles/audio/a2dp.c @@ -1990,6 +1990,7 @@ static void load_remote_sep(struct a2dp_channel *chan, GKeyFile *key_file, if (sscanf(value, "%02hhx:%02hhx", &lseid, &rseid) != 2) { warn("Unable to load LastUsed"); + g_free(value); return; } -- 2.47.3