diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2013-01-06 16:20:16 -0800 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2013-01-06 16:20:16 -0800 |
commit | 916a29bac416d8e88483e4372dc391bedda541fd (patch) | |
tree | 7e4f40a54aba956c8ad8219237708ecda13380a5 /unit/test-sdp.c | |
parent | 24aa8a8a338ebc88857e2988b99972f2191edda9 (diff) | |
download | bluez-916a29bac416d8e88483e4372dc391bedda541fd.tar.gz |
unit: Fix a few memory leaks with the SDP record registration
Diffstat (limited to 'unit/test-sdp.c')
-rw-r--r-- | unit/test-sdp.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/unit/test-sdp.c b/unit/test-sdp.c index ebbc0eccc..b8ebb2bd8 100644 --- a/unit/test-sdp.c +++ b/unit/test-sdp.c @@ -349,6 +349,12 @@ static void register_serial_port(void) sdp_set_service_avail(record, 0xff); sdp_set_record_state(record, 0x00001234); + sdp_data_free(channel); + sdp_list_free(proto[0], 0); + sdp_list_free(proto[1], 0); + sdp_list_free(apseq, 0); + sdp_list_free(aproto, 0); + update_db_timestamp(); } @@ -412,6 +418,16 @@ static void register_object_push(void) sdp_set_info_attr(record, "OBEX Object Push", 0, 0); + sdp_data_free(channel); + sdp_list_free(root, 0); + sdp_list_free(svclass_id, 0); + sdp_list_free(pfseq, 0); + sdp_list_free(proto[0], 0); + sdp_list_free(proto[1], 0); + sdp_list_free(proto[2], 0); + sdp_list_free(apseq, 0); + sdp_list_free(aproto, 0); + update_db_timestamp(); } @@ -503,17 +519,20 @@ static void register_hid_keyboard(void) sdp_uuid16_create(&root_uuid, PUBLIC_BROWSE_GROUP); root = sdp_list_append(0, &root_uuid); sdp_set_browse_groups(record, root); + sdp_list_free(root, 0); sdp_add_lang_attr(record); sdp_uuid16_create(&hidkb_uuid, HID_SVCLASS_ID); svclass_id = sdp_list_append(0, &hidkb_uuid); sdp_set_service_classes(record, svclass_id); + sdp_list_free(svclass_id, 0); sdp_uuid16_create(&profile[0].uuid, HID_PROFILE_ID); profile[0].version = 0x0100; pfseq = sdp_list_append(0, profile); sdp_set_profile_descs(record, pfseq); + sdp_list_free(pfseq, 0); /* protocols */ sdp_uuid16_create(&l2cap_uuid, L2CAP_UUID); @@ -529,6 +548,12 @@ static void register_hid_keyboard(void) aproto = sdp_list_append(0, apseq); sdp_set_access_protos(record, aproto); + sdp_data_free(psm); + sdp_list_free(proto[1], 0); + sdp_list_free(proto[2], 0); + sdp_list_free(apseq, 0); + sdp_list_free(aproto, 0); + /* additional protocols */ proto[1] = sdp_list_append(0, &l2cap_uuid); psm = sdp_data_alloc(SDP_UINT16, &intr); @@ -542,6 +567,12 @@ static void register_hid_keyboard(void) aproto = sdp_list_append(0, apseq); sdp_set_add_access_protos(record, aproto); + sdp_data_free(psm); + sdp_list_free(proto[1], 0); + sdp_list_free(proto[2], 0); + sdp_list_free(apseq, 0); + sdp_list_free(aproto, 0); + sdp_set_info_attr(record, "HID Keyboard", NULL, NULL); for (i = 0; i < sizeof(hid_attr) / 2; i++) @@ -626,6 +657,16 @@ static void register_file_transfer(void) sdp_set_info_attr(record, "OBEX File Transfer", 0, 0); + sdp_data_free(channel); + sdp_list_free(root, 0); + sdp_list_free(svclass_id, 0); + sdp_list_free(pfseq, 0); + sdp_list_free(proto[0], 0); + sdp_list_free(proto[1], 0); + sdp_list_free(proto[2], 0); + sdp_list_free(apseq, 0); + sdp_list_free(aproto, 0); + update_db_timestamp(); } |