From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32454 invoked by alias); 1 Oct 2013 14:08:55 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 32440 invoked by uid 89); 1 Oct 2013 14:08:54 -0000 Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 01 Oct 2013 14:08:54 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=1.5 required=5.0 tests=AWL,BAYES_00,GARBLED_BODY,RDNS_NONE,SPF_HELO_FAIL autolearn=no version=3.3.2 X-HELO: relay1.mentorg.com Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1VR0d8-0007CU-Oa from Yao_Qi@mentor.com ; Tue, 01 Oct 2013 07:08:50 -0700 Received: from SVR-ORW-FEM-05.mgc.mentorg.com ([147.34.97.43]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Tue, 1 Oct 2013 07:08:50 -0700 Received: from qiyao.dyndns.org (147.34.91.1) by svr-orw-fem-05.mgc.mentorg.com (147.34.97.43) with Microsoft SMTP Server id 14.2.247.3; Tue, 1 Oct 2013 07:08:49 -0700 Message-ID: <524AD719.9030909@codesourcery.com> Date: Tue, 01 Oct 2013 14:08:00 -0000 From: Yao Qi User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 MIME-Version: 1.0 To: Pedro Alves CC: Subject: Re: [PATCH 1/6] Move notif_queue to remote_state References: <1376877311-4135-1-git-send-email-yao@codesourcery.com> <1376877311-4135-2-git-send-email-yao@codesourcery.com> <52430B69.4090301@redhat.com> <5249293D.8050700@codesourcery.com> <5249B011.1080207@redhat.com> In-Reply-To: <5249B011.1080207@redhat.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2013-10/txt/msg00052.txt.bz2 On 10/01/2013 01:08 AM, Pedro Alves wrote: >> -static void >> >-notif_xfree (struct notif_client *notif) > ... >> >- if (notif->pending_event != NULL >> >- && notif->pending_event->dtr != NULL) >> >- notif->pending_event->dtr (notif->pending_event); > Hmm, it's not clear to me from reading the patch where is > pending_event released after this patch. Could you help > me understand that? Since notif_queue is a global variable, we've never used QUEUE_free to free notif_queue, so notif_xfree is never called, and pending_event on each notif_client is not released. When we move notif_queue to 'remote_notif_state', we have to explicitly use QUEUE_free to free notif_queue and elements in it. We put the pointer of each notif_client to notif_queue, so we don't need a function to free the notif_client when notif_queue is destroyed. So the notif_queue is allocated like this, notif_state->notif_queue = QUEUE_alloc (notif_client_p, NULL); and notif_xfree is not needed any more. The leak on pending_event is still there, but it is fixed by the next patch, which moves pending_event to remote_notif_state, and pending_event is freed in remote_notif_state_xfree. -- Yao (齐尧)