From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Third Newsgroups: gmane.emacs.bugs Subject: bug#43135: 28.0.50; image.c compiler warning Date: Tue, 1 Sep 2020 20:55:29 +0200 (CEST) Message-ID: <20200901185526.GA93185@breton.holly.idiocy.org> References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="LZvS9be/3tNcYl/X" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11261"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 43135@debbugs.gnu.org To: David Fussner Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Sep 01 20:56:13 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kDBS0-0002ls-VB for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 01 Sep 2020 20:56:13 +0200 Original-Received: from localhost ([::1]:56902 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kDBRz-0002Tm-Sn for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 01 Sep 2020 14:56:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52020) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kDBRr-0002SP-Je for bug-gnu-emacs@gnu.org; Tue, 01 Sep 2020 14:56:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:45755) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kDBRr-00028W-9d for bug-gnu-emacs@gnu.org; Tue, 01 Sep 2020 14:56:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kDBRr-00047s-99 for bug-gnu-emacs@gnu.org; Tue, 01 Sep 2020 14:56:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Third Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 01 Sep 2020 18:56:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43135 X-GNU-PR-Package: emacs Original-Received: via spool by 43135-submit@debbugs.gnu.org id=B43135.159898654115806 (code B ref 43135); Tue, 01 Sep 2020 18:56:03 +0000 Original-Received: (at 43135) by debbugs.gnu.org; 1 Sep 2020 18:55:41 +0000 Original-Received: from localhost ([127.0.0.1]:57296 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kDBRV-00046s-9W for submit@debbugs.gnu.org; Tue, 01 Sep 2020 14:55:41 -0400 Original-Received: from mailout-l3b-97.contactoffice.com ([212.3.242.97]:48434) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kDBRS-00046c-4B for 43135@debbugs.gnu.org; Tue, 01 Sep 2020 14:55:39 -0400 Original-Received: from smtpauth2.co-bxl (smtpauth2.co-bxl [10.2.0.24]) by mailout-l3b-97.contactoffice.com (Postfix) with ESMTP id 750B41A9; Tue, 1 Sep 2020 20:55:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1598986531; s=20200222-6h9o; d=idiocy.org; i=alan@idiocy.org; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:Content-Type:In-Reply-To; l=2803; bh=7ZCfgy4ZP5EnxJTlklBOVHJR4cYQiDJ9K7kn8QY2uEg=; b=dLHcdFZzk/34Duqya5OvT9X0rPw4SyNkc+U+IZ+Qwz/wY8344KCSHcv2pPVAIiJj Urr1tPb2kpJWQaGtWRoAvfUbI4U5gPYlwg0F4RuiY+LT4FfzIe2ClYRJTZS+V7N+d2M I5bUkMEMchvSncKdkmmuakYa3lfIyZIzi+MJMubxsWMBJQnsahnUt8gKzmqN6PX39pP HCGeG6kCAO0OblVQWzDDmf05SCsgWVZRmbuoMRLILu9kTBLu4ys6IyqgM6wreDj8O5N XN7b8sqHcBEw70FLsaueZpsCoJVDSx5fa91OxpljlsnAh+P1OcFniNIASO/tURwaQAX fJ+VRHIjig== Original-Received: by smtp.mailfence.com with ESMTPA ; Tue, 1 Sep 2020 20:55:27 +0200 (CEST) Original-Received: by breton.holly.idiocy.org (Postfix, from userid 501) id AF78820250B2CE; Tue, 1 Sep 2020 19:55:26 +0100 (BST) Mail-Followup-To: Alan Third , David Fussner , 43135@debbugs.gnu.org Content-Disposition: inline In-Reply-To: X-ContactOffice-Account: com:241649512 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:186883 Archived-At: --LZvS9be/3tNcYl/X Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Aug 31, 2020 at 02:52:44PM +0100, David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors wrote: > For the last week or so I'm seeing this warning when compiling master, > always using the simple command 'make' in the git repo: > > CC image.o > image.c: In function 'svg_load_image': > image.c:9892:3: warning: implicit declaration of function 'free' > [-Wimplicit-function-declaration] > free (wrapped_contents); > ^ > image.c:9892:3: warning: incompatible implicit declaration of built-in > function 'free' > image.c:9892:3: note: include '' or provide a declaration of > 'free' > > This is a 32-bit build, and Slackware 14.2's gcc is 5.5.0. The > executable runs just fine. > > The warning appears after commit > 8f42b94fe43911c6b0c7e519ba439d61459dc744 by Alan Third: > Set basic SVG attributes (bug#40845) > > Including at the top of image.c does silence the warning. Hi, can you please try the attached patch. -- Alan Third --LZvS9be/3tNcYl/X Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="0001-src-image.c-svg_load_image-Use-xmalloc-and-xfree.-bu.patch" >From 4419564a3f9895f932c2e5dc7123eda0b64bbd0e Mon Sep 17 00:00:00 2001 From: Alan Third Date: Tue, 1 Sep 2020 19:53:01 +0100 Subject: [PATCH] * src/image.c (svg_load_image): Use xmalloc and xfree. (bug#43135) --- src/image.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/image.c b/src/image.c index 35c5946c72..d8c34669cc 100644 --- a/src/image.c +++ b/src/image.c @@ -9830,7 +9830,7 @@ svg_load_image (struct frame *f, struct image *img, char *contents, img->background_valid = 1; } - wrapped_contents = malloc (buffer_size); + wrapped_contents = xmalloc (buffer_size); if (!wrapped_contents || buffer_size <= snprintf (wrapped_contents, buffer_size, wrapper, @@ -9889,7 +9889,7 @@ svg_load_image (struct frame *f, struct image *img, char *contents, pixbuf = rsvg_handle_get_pixbuf (rsvg_handle); if (!pixbuf) goto rsvg_error; g_object_unref (rsvg_handle); - free (wrapped_contents); + xfree (wrapped_contents); /* Extract some meta data from the svg handle. */ width = gdk_pixbuf_get_width (pixbuf); @@ -9960,7 +9960,7 @@ svg_load_image (struct frame *f, struct image *img, char *contents, if (rsvg_handle) g_object_unref (rsvg_handle); if (wrapped_contents) - free (wrapped_contents); + xfree (wrapped_contents); /* FIXME: Use error->message so the user knows what is the actual problem with the image. */ image_error ("Error parsing SVG image `%s'", img->spec); -- 2.26.1 --LZvS9be/3tNcYl/X--