Already existing snoop file is renamed by adding ".old" suffix before
new one is created. This is useful in case phone is restarted so logs
are not overwritten and for this reason it's only applied in case
default snoop file name is used.
---
android/bluetoothd-snoop.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/android/bluetoothd-snoop.c b/android/bluetoothd-snoop.c
index 02f44e9..23e0bfd 100644
--- a/android/bluetoothd-snoop.c
+++ b/android/bluetoothd-snoop.c
@@ -206,6 +206,9 @@ int main(int argc, char *argv[])
mainloop_set_signal(&mask, signal_callback, NULL, NULL);
+ if (!strcmp(DEFAULT_SNOOP_FILE, path))
+ rename(DEFAULT_SNOOP_FILE, DEFAULT_SNOOP_FILE ".old");
+
if (open_monitor(path) < 0) {
printf("Failed to start bluetoothd_snoop\n");
return EXIT_FAILURE;
--
1.8.5.2
Hi Andrzej,
On Wednesday 15 of January 2014 22:01:36 Andrzej Kaczmarek wrote:
> Already existing snoop file is renamed by adding ".old" suffix before
> new one is created. This is useful in case phone is restarted so logs
> are not overwritten and for this reason it's only applied in case
> default snoop file name is used.
> ---
> android/bluetoothd-snoop.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/android/bluetoothd-snoop.c b/android/bluetoothd-snoop.c
> index 02f44e9..23e0bfd 100644
> --- a/android/bluetoothd-snoop.c
> +++ b/android/bluetoothd-snoop.c
> @@ -206,6 +206,9 @@ int main(int argc, char *argv[])
>
> mainloop_set_signal(&mask, signal_callback, NULL, NULL);
>
> + if (!strcmp(DEFAULT_SNOOP_FILE, path))
> + rename(DEFAULT_SNOOP_FILE, DEFAULT_SNOOP_FILE ".old");
> +
> if (open_monitor(path) < 0) {
> printf("Failed to start bluetoothd_snoop\n");
> return EXIT_FAILURE;
>
All patches in this set applied, thanks.
(after changing commits order to not break build in 1/4)
--
Best regards,
Szymon Janc
avdtp_service_cap_new() makes own copy of data stored in "codec" thus
it should be freed by caller.
This fixes following Valgrind report:
==1238== 6 bytes in 1 blocks are definitely lost in loss record 27 of 54
==1238== at 0x4896DC8: calloc (in /system/lib/valgrind/vgpreload_memcheck-arm-linux.so)
==1238== by 0x48C5DB7: g_malloc0 (gmem.c:189)
==1238== by 0x115B4B: discover_cb (a2dp.c:303)
==1238== by 0x111DE7: finalize_discovery (avdtp.c:933)
==1238== by 0x114441: session_cb (avdtp.c:2556)
==1238== by 0x48BD9C7: g_io_unix_dispatch (giounix.c:166)
==1238== by 0x48C2CCB: g_main_context_dispatch (gmain.c:2539)
==1238== by 0x48C2ED9: g_main_context_iterate.isra.19 (gmain.c:3146)
==1238== by 0x48C3167: g_main_loop_run (gmain.c:3340)
==1238== by 0x10B207: main (main.c:436)
---
android/a2dp.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/android/a2dp.c b/android/a2dp.c
index 35ffe46..a5ea5a0 100644
--- a/android/a2dp.c
+++ b/android/a2dp.c
@@ -309,6 +309,8 @@ static int select_configuration(struct a2dp_device *dev,
sizeof(*codec) + preset->len);
caps = g_slist_append(caps, service);
+ g_free(codec);
+
err = avdtp_set_configuration(dev->session, rsep, endpoint->sep, caps,
&stream);
g_slist_free_full(caps, g_free);
--
1.8.5.2
audio_ipc_send_rsp_full() does not free buffer passed as parameter
thus it should be freed by caller.
This fixes following Valgrind report:
==1238== 5 bytes in 1 blocks are definitely lost in loss record 22 of 54
==1238== at 0x4896DC8: calloc (in /system/lib/valgrind/vgpreload_memcheck-arm-linux.so)
==1238== by 0x48C5DB7: g_malloc0 (gmem.c:189)
==1238== by 0x1150EF: bt_stream_open (a2dp.c:1177)
==1238== by 0x1116A7: ipc_handle_msg (ipc.c:95)
==1238== by 0x111C11: audio_watch_cb (audio-ipc.c:66)
==1238== by 0x48BD9C7: g_io_unix_dispatch (giounix.c:166)
==1238== by 0x48C2CCB: g_main_context_dispatch (gmain.c:2539)
==1238== by 0x48C2ED9: g_main_context_iterate.isra.19 (gmain.c:3146)
==1238== by 0x48C3167: g_main_loop_run (gmain.c:3340)
==1238== by 0x10B207: main (main.c:436)
---
android/a2dp.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/android/a2dp.c b/android/a2dp.c
index a5ea5a0..a36e9a3 100644
--- a/android/a2dp.c
+++ b/android/a2dp.c
@@ -1181,6 +1181,8 @@ static void bt_stream_open(const void *buf, uint16_t len)
memcpy(rsp->preset->data, setup->preset->data, setup->preset->len);
audio_ipc_send_rsp_full(AUDIO_OP_OPEN_STREAM, len, rsp, -1);
+
+ g_free(rsp);
}
static void bt_stream_close(const void *buf, uint16_t len)
--
1.8.5.2
---
android/bluetoothd-snoop.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/android/bluetoothd-snoop.c b/android/bluetoothd-snoop.c
index 23e0bfd..9312c11 100644
--- a/android/bluetoothd-snoop.c
+++ b/android/bluetoothd-snoop.c
@@ -37,7 +37,7 @@
#include "monitor/mainloop.h"
#include "src/shared/btsnoop.h"
-#define DEAULT_SNOOP_FILE "/sdcard/btsnoop_hci.log"
+#define DEFAULT_SNOOP_FILE "/sdcard/btsnoop_hci.log"
#define MAX_PACKET_SIZE (1486 + 4)
@@ -196,7 +196,7 @@ int main(int argc, char *argv[])
if (argc > 1)
path = argv[1];
else
- path = DEAULT_SNOOP_FILE;
+ path = DEFAULT_SNOOP_FILE;
mainloop_init();
--
1.8.5.2