Skip to content

Commit

Permalink
rfcomm-tester: Fix crash on test-basic
Browse files Browse the repository at this point in the history
This fixes to following trace caused by not initializing data->io:

AddressSanitizer:DEADLYSIGNAL
=================================================================
ERROR: AddressSanitizer: SEGV on unknown address
(pc 0x7f199c3a01c9 bp 0x7ffc26624a10 sp 0x7ffc26624a00 T0)
The signal is caused by a READ memory access.
Hint: this fault was caused by a dereference of a high value address
(see register values below).  Disassemble the provided pc to learn .
    #0 0x7f199c3a01c9 in g_io_channel_unref (/lib64/libglib-2.0.so.0+0x4d1c9)
    #1 0x5565f82fcece in test_post_teardown tools/rfcomm-tester.c:205
    #2 0x5565f83939b3 in teardown_callback src/shared/tester.c:434
  • Loading branch information
Vudentz committed Feb 15, 2024
1 parent f3c35ed commit fb339bd
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions tools/rfcomm-tester.c
Expand Up @@ -30,6 +30,7 @@

#include "src/shared/tester.h"
#include "src/shared/mgmt.h"
#include "src/shared/util.h"

struct test_data {
struct mgmt *mgmt;
Expand Down Expand Up @@ -815,9 +816,7 @@ static void test_server(const void *test_data)
#define test_rfcomm(name, data, setup, func) \
do { \
struct test_data *user; \
user = malloc(sizeof(struct test_data)); \
if (!user) \
break; \
user = new0(struct test_data, 1); \
user->hciemu_type = HCIEMU_TYPE_BREDRLE52; \
user->test_data = data; \
user->io_id = 0; \
Expand Down

0 comments on commit fb339bd

Please sign in to comment.