sdptool
Hi!
I am following the code of sdptool.c and I have a question. I am comparing add_sp() and add_opush() and I have found something that puzzles me. The first part of the code is almost the same, but there are some sdp_list_free() calls in add_opush() that are present in add_sp(). For example:
static int add_sp(sdp_session_t *session, svc_info_t *si) {
/* ... */
sdp_uuid16_create(&sp_uuid, SERIAL_PORT_SVCLASS_ID); svclass_id = sdp_list_append(0, &sp_uuid); sdp_set_service_classes(&record, svclass_id); sdp_list_free(svclass_id, 0);
/* ... */
}
static int add_opush(sdp_session_t *session, svc_info_t *si) {
/* ... */
sdp_uuid16_create(&opush_uuid, OBEX_OBJPUSH_SVCLASS_ID); svclass_id = sdp_list_append(0, &opush_uuid); sdp_set_service_classes(&record, svclass_id); /* ... */
}
Is this correct? Shouldn't there be a call to sdp_list_free(svclass_id, 0) in add_opush() too? As I understand it, this means that add_opush() has a memory leak, isn't it? I have found at least three missing calls to sdp_list_free() in add_opush().
Regards,
Pedro Monjo
-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.
Get your fingers limbered up and give it your best shot. 4 great events, 4 opportunities to win big! Highest score wins.NEC IT Guy Games. Play to win an NEC 61 plasma display. Visit http://www.necitguy.com/?r=20
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users
Hi Pedro,
You could run valgrind on the different runs of sdptool to verify that there is a leak here. Send in a patch!
Cheers,
Steve
Quoted 46 lines · Pedro Monjo Florit
Hi!
I am following the code of
sdptool.cand I have a question. I am comparingadd_sp()andadd_opush()and I have found something that puzzles me. The first part of the code is almost the same, but there are somesdp_list_free()calls inadd_opush()that are present inadd_sp(). For example:static int
add_sp(sdp_session_t *session, svc_info_t *si){ /* ... */ sdp_uuid16_create(&sp_uuid, SERIAL_PORT_SVCLASS_ID); svclass_id = sdp_list_append(0, &sp_uuid); sdp_set_service_classes(&record, svclass_id); sdp_list_free(svclass_id, 0); /* ... */ }static int
add_opush(sdp_session_t *session, svc_info_t *si){ /* ... */ sdp_uuid16_create(&opush_uuid, OBEX_OBJPUSH_SVCLASS_ID); svclass_id = sdp_list_append(0, &opush_uuid); sdp_set_service_classes(&record, svclass_id); /* ... */ }Is this correct? Shouldn't there be a call to sdp_list_free(svclass_id,
0) inadd_opush()too? As I understand it, this means thatadd_opush()has a memory leak, isn't it? I have found at least three missing calls tosdp_list_free()inadd_opush().Regards,
Pedro Monjo
-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.
Get your fingers limbered up and give it your best shot. 4 great events, 4 opportunities to win big! Highest score wins.NEC IT Guy Games. Play to win an NEC 61 plasma display. Visit http://www.necitguy.com/?r=20
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users
Signature · 14 lines
Stephen Crane, Rococo Software Ltd. http://www.rococosoft.com [email protected] +353-1-6601315 (ext 209) ------------------------------------------------------- This SF.Net email is sponsored by: NEC IT Guy Games. Get your fingers limbered up and give it your best shot. 4 great events, 4 opportunities to win big! Highest score wins.NEC IT Guy Games. Play to win an NEC 61 plasma display. Visit http://www.necitguy.com/?r=20 _______________________________________________ Bluez-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/bluez-users