From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17603 invoked by alias); 11 Jan 2012 00:25:23 -0000 Received: (qmail 17590 invoked by uid 22791); 11 Jan 2012 00:25:22 -0000 X-SWARE-Spam-Status: No, hits=-0.7 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from router-304.cs.umd.edu (HELO bacon.cs.umd.edu) (128.8.127.145) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 11 Jan 2012 00:25:09 +0000 Received: from [192.168.32.3] (pool-71-163-241-15.washdc.fios.verizon.net [71.163.241.15]) (Authenticated sender: khooyp) by bacon.cs.umd.edu (Postfix) with ESMTPSA id 9E8BFB40927; Tue, 10 Jan 2012 19:25:07 -0500 (EST) From: Khoo Yit Phang Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Subject: xfree/make_cleanup memory leak pattern? Date: Wed, 11 Jan 2012 00:25:00 -0000 Message-Id: <197CEDA3-0851-4FD2-B821-FD800C991F2D@cs.umd.edu> Cc: Khoo Yit Phang To: gdb@sourceware.org Mime-Version: 1.0 (Apple Message framework v1084) X-CSD-MailScanner-ID: 9E8BFB40927.AE776 X-CSD-MailScanner: Found to be clean X-CSD-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-50, required 5, autolearn=not spam, ALL_TRUSTED -50.00) X-CSD-MailScanner-From: khooyp@cs.umd.edu X-CSD-MailScanner-Watermark: 1326846307.96212@SZ8oyYbrEYJKFBq3BmDH7w Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2012-01/txt/msg00034.txt.bz2 Hi, I noticed the following code pattern in various places in GDB: script =3D compute_python_string (cmd->body_list[0]); ... xfree (script); and also others like: full_path =3D tilde_expand (filename); ... cleanup =3D make_cleanup (xfree, full_path);=20 If I understand correctly, wouldn't these patterns lead to a memory leak if= the user manages to trigger a SIGINT (with immediate_quit in effect) at th= e "..." in between the memory allocation and xfree/make_cleanup? It's a tin= y window in most cases, but something like compute_python_string could take= some time. Yit January 10, 2012