From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36110) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YWiAx-00058i-Fm for qemu-devel@nongnu.org; Sat, 14 Mar 2015 05:16:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YWiAw-0007d0-LX for qemu-devel@nongnu.org; Sat, 14 Mar 2015 05:16:07 -0400 Message-ID: <5503FC2B.3090004@huawei.com> Date: Sat, 14 Mar 2015 17:15:23 +0800 From: Shannon Zhao MIME-Version: 1.0 References: <1426304530-9600-1-git-send-email-zhaoshenglong@huawei.com> <5503DBDB.9040804@weilnetz.de> In-Reply-To: <5503DBDB.9040804@weilnetz.de> Content-Type: text/plain; charset="ISO-8859-15" Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] hw/bt/sdp: Fix resource leak detect by coverity List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Weil , qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, hangaohuai@huawei.com, qemu-trivial@nongnu.org, mjt@tls.msk.ru, peter.huangpeng@huawei.com, shannon.zhao@linaro.org, pbonzini@redhat.com On 2015/3/14 14:57, Stefan Weil wrote: > Am 14.03.2015 um 04:42 schrieb Shannon Zhao: >> Free data in function sdp_attr_write after use. >> >> Signed-off-by: Shannon Zhao >> Signed-off-by: Shannon Zhao >> --- >> hw/bt/sdp.c | 1 + >> 1 file changed, 1 insertion(+) >> >> diff --git a/hw/bt/sdp.c b/hw/bt/sdp.c >> index 218e075..8e6d5e3 100644 >> --- a/hw/bt/sdp.c >> +++ b/hw/bt/sdp.c >> @@ -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. > >> /* Sort the attribute list by the AttributeID */ >> qsort(record->attribute_list, record->attributes, > > > . >