From: Alan Third <alan@idiocy.org>
To: David Fussner <dfussner@googlemail.com>
Cc: 43135@debbugs.gnu.org
Subject: bug#43135: 28.0.50; image.c compiler warning
Date: Tue, 1 Sep 2020 20:55:29 +0200 (CEST) [thread overview]
Message-ID: <20200901185526.GA93185@breton.holly.idiocy.org> (raw)
In-Reply-To: <CADF+Rtik-UM7CWfqQPadgHJot+v=Xv8_OvTfAYUd4Pt-AYuevw@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1005 bytes --]
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 '<stdlib.h>' 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 <stdlib.h> at the top of image.c does silence the warning.
Hi, can you please try the attached patch.
--
Alan Third
[-- Attachment #2: 0001-src-image.c-svg_load_image-Use-xmalloc-and-xfree.-bu.patch --]
[-- Type: text/plain, Size: 1525 bytes --]
From 4419564a3f9895f932c2e5dc7123eda0b64bbd0e Mon Sep 17 00:00:00 2001
From: Alan Third <alan@idiocy.org>
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
next prev parent reply other threads:[~2020-09-01 18:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-31 13:52 bug#43135: 28.0.50; image.c compiler warning David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-09-01 18:55 ` Alan Third [this message]
2020-09-02 6:34 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-09-03 19:57 ` Alan Third
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200901185526.GA93185@breton.holly.idiocy.org \
--to=alan@idiocy.org \
--cc=43135@debbugs.gnu.org \
--cc=dfussner@googlemail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).