From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1OtUJV-0000oc-SN for mharc-grub-devel@gnu.org; Wed, 08 Sep 2010 19:44:25 -0400 Received: from [140.186.70.92] (port=34611 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OtUJS-0000mD-Il for grub-devel@gnu.org; Wed, 08 Sep 2010 19:44:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OtUJR-0001ZB-AL for grub-devel@gnu.org; Wed, 08 Sep 2010 19:44:22 -0400 Received: from mail-bw0-f41.google.com ([209.85.214.41]:35180) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OtUJR-0001Yx-5w for grub-devel@gnu.org; Wed, 08 Sep 2010 19:44:21 -0400 Received: by bwz6 with SMTP id 6so774759bwz.0 for ; Wed, 08 Sep 2010 16:44:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=j7RftOJThqbUMwrxGTIim3NME+ptQmKoMay/rqh++TU=; b=QwNIYLlVfAcNcyxUAHzvcnM4ZTqKCFlQ752qpLKezPJ7UYFHhGcnRzrqhBhktNxqED gkLLRaBtVxJbxGHXILPIlNETaadOkndZNHKYZ6Me4MADxUhk7QCuwvpo1m3NvTNph1Mk jbDj+Dj55qyBn6skDsGoz/3Uqo3VVdqzXV9ug= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; b=owgVo+pM7ao02eBzmlEnfypfLKl2cZuHmLX5K0VCarTkxNlwEF/kBsAJI7ziutnIyl VESh2IYUWjETA4vJyJ1VrGOFf1dJsHwZVDznoEmgwi442CA077kWhLSbrXiFRtV7Z2IP yhcV/mdUkOX2YugTVIeJDNp+5/UgPkBQpNlCw= Received: by 10.204.35.69 with SMTP id o5mr192907bkd.87.1283989459869; Wed, 08 Sep 2010 16:44:19 -0700 (PDT) Received: from debian.yeeloong.phnet (196-36.76-83.cust.bluewin.ch [83.76.36.196]) by mx.google.com with ESMTPS id s34sm520297bkk.13.2010.09.08.16.44.14 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 08 Sep 2010 16:44:18 -0700 (PDT) Message-ID: <4C881FC8.7020208@gmail.com> Date: Thu, 09 Sep 2010 01:44:08 +0200 From: =?UTF-8?B?VmxhZGltaXIgJ8+GLWNvZGVyL3BoY29kZXInIFNlcmJpbmVua28=?= User-Agent: Mozilla/5.0 (X11; U; Linux mips64; en-US; rv:1.9.1.11) Gecko/20100805 Icedove/3.0.6 MIME-Version: 1.0 To: grub-devel@gnu.org References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: Re: gazillon of double-free X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2010 23:44:23 -0000 On 09/09/10 01:20, Robert Millan wrote: > It seems we have a ton of double-free bugs in label() and > uuid() routines. > > Take for example grub_ext2_label(): > > data = grub_ext2_mount (disk); > if (data) > *label = grub_strndup (data->sblock.volume_name, 14); > else > *label = NULL; > grub_free (data); > > If grub_ext2_mount fails, data is not allocated but we free it anyway. > > Or perhaps I'm missing something? (it's late here, I need some sleep) > > grub_free (NULL) is a no-op on purpose: /* Deallocate the pointer PTR. */ void grub_free (void *ptr) { grub_mm_header_t p; grub_mm_region_t r; if (! ptr) return; -- Regards Vladimir 'φ-coder/phcoder' Serbinenko