From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58798) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YWg0x-00057m-OE for qemu-devel@nongnu.org; Sat, 14 Mar 2015 02:57:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YWg0t-0001aW-5n for qemu-devel@nongnu.org; Sat, 14 Mar 2015 02:57:39 -0400 Received: from [2a03:4000:1::4e2f:c7ac:d] (port=50546 helo=v220110690675601.yourvserver.net) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YWg0s-0001aN-VX for qemu-devel@nongnu.org; Sat, 14 Mar 2015 02:57:35 -0400 Message-ID: <5503DBDB.9040804@weilnetz.de> Date: Sat, 14 Mar 2015 07:57:31 +0100 From: Stefan Weil MIME-Version: 1.0 References: <1426304530-9600-1-git-send-email-zhaoshenglong@huawei.com> In-Reply-To: <1426304530-9600-1-git-send-email-zhaoshenglong@huawei.com> Content-Type: text/plain; charset=iso-8859-15; format=flowed 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: Shannon Zhao , 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 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. > > /* Sort the attribute list by the AttributeID */ > qsort(record->attribute_list, record->attributes,