From: Andreas Schwab Date: Tue, 12 Apr 2011 10:20:32 +0000 (+0200) Subject: Use xfree instead of free where appropriate (Bug#8437) X-Git-Tag: emacs-pretest-24.0.90~104^2~275^2~283^2~14 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=baad03f0e1fe3bf27d52a425e0e374af6d1cf407;p=emacs.git Use xfree instead of free where appropriate (Bug#8437) * charset.c (Fclear_charset_maps): Use xfree instead of free. (Bug#8437) * keyboard.c (parse_tool_bar_item): Likewise. * sound.c (sound_cleanup, alsa_close): Likewise. * termcap.c (tgetent): Likewise. * xfns.c (x_default_font_parameter): Likewise. * xsettings.c (read_and_apply_settings): Likewise. --- diff --git a/src/ChangeLog b/src/ChangeLog index b1e17766f37..211625ee446 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,13 @@ 2011-04-12 Andreas Schwab + * charset.c (Fclear_charset_maps): Use xfree instead of free. + (Bug#8437) + * keyboard.c (parse_tool_bar_item): Likewise. + * sound.c (sound_cleanup, alsa_close): Likewise. + * termcap.c (tgetent): Likewise. + * xfns.c (x_default_font_parameter): Likewise. + * xsettings.c (read_and_apply_settings): Likewise. + * alloc.c (overrun_check_malloc, overrun_check_realloc) (overrun_check_free): Protoize. diff --git a/src/charset.c b/src/charset.c index 00206cccf0b..783d7db5733 100644 --- a/src/charset.c +++ b/src/charset.c @@ -2145,7 +2145,7 @@ It should be called only from temacs invoked for dumping. */) { if (temp_charset_work) { - free (temp_charset_work); + xfree (temp_charset_work); temp_charset_work = NULL; } diff --git a/src/keyboard.c b/src/keyboard.c index 5df4f1b1ff4..a73f6656cd2 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -8253,7 +8253,7 @@ parse_tool_bar_item (Lisp_Object key, Lisp_Object item) PROP (TOOL_BAR_ITEM_LABEL) = new_lbl; else PROP (TOOL_BAR_ITEM_LABEL) = make_string ("", 0); - free (buf); + xfree (buf); } /* If got a filter apply it on binding. */ diff --git a/src/sound.c b/src/sound.c index a9bd540aaa9..7d7317e71b3 100644 --- a/src/sound.c +++ b/src/sound.c @@ -460,8 +460,8 @@ sound_cleanup (Lisp_Object arg) current_sound_device->close (current_sound_device); if (current_sound->fd > 0) emacs_close (current_sound->fd); - free (current_sound_device); - free (current_sound); + xfree (current_sound_device); + xfree (current_sound); return Qnil; } @@ -1095,7 +1095,7 @@ alsa_close (struct sound_device *sd) snd_pcm_drain (p->handle); snd_pcm_close (p->handle); } - free (p); + xfree (p); } } diff --git a/src/termcap.c b/src/termcap.c index 27a20a67ae1..5b71ad229d7 100644 --- a/src/termcap.c +++ b/src/termcap.c @@ -1,6 +1,6 @@ /* Work-alike for termcap, plus extra features. Copyright (C) 1985, 1986, 1993, 1994, 1995, 2000, 2001, 2002, 2003, - 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. + 2004, 2005, 2006, 2007, 2008, 2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -468,15 +468,15 @@ tgetent (char *bp, const char *name) if (scan_file (term, fd, &buf) == 0) { close (fd); - free (buf.beg); + xfree (buf.beg); if (malloc_size) - free (bp); + xfree (bp); return 0; } /* Free old `term' if appropriate. */ if (term != name) - free (term); + xfree (term); /* If BP is malloc'd by us, make sure it is big enough. */ if (malloc_size) @@ -506,7 +506,7 @@ tgetent (char *bp, const char *name) } close (fd); - free (buf.beg); + xfree (buf.beg); if (malloc_size) bp = (char *) xrealloc (bp, bp1 - bp + 1); diff --git a/src/xfns.c b/src/xfns.c index 04b8e44b561..33b21c84b2c 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -2983,7 +2983,7 @@ x_default_font_parameter (struct frame *f, Lisp_Object parms) { char *name = xstrdup (system_font); font = font_open_by_name (f, name); - free (name); + xfree (name); } } diff --git a/src/xsettings.c b/src/xsettings.c index 097b2477e03..24ea48e7b67 100644 --- a/src/xsettings.c +++ b/src/xsettings.c @@ -566,20 +566,20 @@ read_and_apply_settings (struct x_display_info *dpyinfo, int send_event_p) if (send_event_p) store_config_changed_event (Qtool_bar_style, dpyname); } - free (settings.tb_style); + xfree (settings.tb_style); } if (settings.seen & SEEN_FONT) { if (!current_font || strcmp (current_font, settings.font) != 0) { - free (current_font); + xfree (current_font); current_font = settings.font; if (send_event_p) store_config_changed_event (Qfont_name, dpyname); } else - free (settings.font); + xfree (settings.font); } }