hw/bt/sdp: Fix resource leak detect by coverity
PATCH 1/1 hw/bt/sdp: Fix resource leak detect by coverity
Free data in function sdp_attr_write after use.
--- hw/bt/sdp.c | 1 + 1 file changed, 1 insertion(+)
hw/bt/sdp.c +1 -0
@@ -735,6 +735,7 @@ static void sdp_service_record_build(struct sdp_service_record_s *record, record->attribute_list[record->attributes ++].len = len; data += len; } +g_free (data);/* Sort the attribute list by the AttributeID */ qsort(record->attribute_list, record->attributes,
Signature · 1 line
1.8.3.1
Am 14.03.2015 um 04:42 schrieb Shannon Zhao:
Quoted 13 lines
Free data in function
sdp_attr_writeafter use.Signed-off-by Shannon Zhao <[email protected]>Signed-off-by Shannon Zhao <[email protected]>--- hw/bt/sdp.c | 1 + 1 file changed, 1 insertion(+)hw/bt/sdp.c +0
-0
hw/bt/sdp.c static void sdp_service_record_build(struct sdp_service_record_s *record, · line 738
Quoted 4 lines
hw/bt/sdp.c +1
-0@@ -735,6 +735,7 @@ static void sdp_service_record_build(struct sdp_service_record_s *record, record->attribute_list[record->attributes ++].len = len; data += len; } +g_free (data);
No, here more work is needed. data is no longer the original data, because two lines above it is modified.
Quoted 3 lines
hw/bt/sdp.c +0
-0/* Sort the attribute list by the AttributeID */ qsort(record->attribute_list, record->attributes,
Quoted 9 lines · Stefan Weil
Am 14.03.2015 um 04:42 schrieb Shannon Zhao:
Quoted 8 lines
Free data in function
sdp_attr_writeafter use.Signed-off-by Shannon Zhao <[email protected]>Signed-off-by Shannon Zhao <[email protected]>--- hw/bt/sdp.c | 1 + 1 file changed, 1 insertion(+)
Quoted 12 lines
hw/bt/sdp.c static void sdp_service_record_build(struct sdp_service_record_s *record, · line 738
Quoted 9 lines
hw/bt/sdp.c +1
-0@@ -735,6 +735,7 @@ static void sdp_service_record_build(struct sdp_service_record_s *record, record->attribute_list[record->attributes ++].len = len; data += len; } +g_free (data);No, here more work is needed. data is no longer the original data, because two lines above it is modified.
Thanks for pointing out.
Quoted 7 lines
hw/bt/sdp.c static void sdp_service_record_build(struct sdp_service_record_s *record, · line 741
Quoted 3 lines
hw/bt/sdp.c +0
-0/* Sort the attribute list by the AttributeID */ qsort(record->attribute_list, record->attributes,.