Commit 81d40c92 authored by Dmitry Antipov's avatar Dmitry Antipov Committed by Paul Eggert

Use xfree, not free, to avoid crash with --enable-checking=xmallocoverrun.

parent e7e2364b
2011-10-13 Dmitry Antipov <dmantipov@yandex.ru>
* lwlib-Xaw.c (openFont, xaw_destroy_instance): Replace free with
xfree to avoid crash when xmalloc overrun checking is enabled.
* lwlib-Xm.c (free_destroyed_instance, xm_update_one_value): Ditto.
* lwlib-utils.c (XtApplyToWidgets): Ditto.
* lwlib.c (safe_free_str, free_widget_value, free_widget_value_tree)
(free_widget_info, free_widget_instance, name_to_widget): Ditto.
* xlwmenu.c (openXftFont): Ditto.
2011-06-27 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
* Makefile.in (ALL_CFLAGS): Add -I../lib for generated header files
......
......@@ -136,7 +136,7 @@ openFont (Widget widget, char *name)
}
fn = XftFontOpenName (XtDisplay (widget), screen, fname);
if (fname != name) free (fname);
if (fname != name) xfree (fname);
return fn;
}
......@@ -384,7 +384,7 @@ xaw_destroy_instance (widget_instance *instance)
if (instance->xft_data[0].xft_font)
XftFontClose (XtDisplay (instance->widget),
instance->xft_data[0].xft_font);
free (instance->xft_data);
xfree (instance->xft_data);
}
#endif
if (XtIsSubclass (instance->widget, dialogWidgetClass))
......
......@@ -186,9 +186,9 @@ make_destroyed_instance (char* name,
static void
free_destroyed_instance (destroyed_instance* instance)
{
free (instance->name);
free (instance->type);
free (instance);
xfree (instance->name);
xfree (instance->type);
xfree (instance);
}
/* motif utility functions */
......@@ -928,13 +928,13 @@ xm_update_one_value (widget_instance* instance,
}
else if (class == xmTextWidgetClass)
{
free (val->value);
xfree (val->value);
val->value = XmTextGetString (widget);
val->edited = True;
}
else if (class == xmTextFieldWidgetClass)
{
free (val->value);
xfree (val->value);
val->value = XmTextFieldGetString (widget);
val->edited = True;
}
......@@ -959,7 +959,7 @@ xm_update_one_value (widget_instance* instance,
XtVaGetValues (toggle, XmNset, &set, NULL);
if (set)
{
free (val->value);
xfree (val->value);
val->value = safe_strdup (XtName (toggle));
}
}
......
......@@ -80,7 +80,7 @@ XtApplyToWidgets (Widget w, XtApplyToWidgetsProc proc, XtPointer arg)
XtApplyToWidgets (kids [i], proc, arg);
proc (kids [i], arg);
}
free (kids);
xfree (kids);
}
}
......
......@@ -138,7 +138,7 @@ my_strcasecmp (const char *s1, const char *s2)
static void
safe_free_str (char *s)
{
free (s);
xfree (s);
}
static widget_value *widget_value_free_list = 0;
......@@ -176,7 +176,7 @@ free_widget_value (widget_value *wv)
{
/* When the number of already allocated cells is too big,
We free it. */
free (wv);
xfree (wv);
malloc_cpt--;
}
else
......@@ -192,9 +192,9 @@ free_widget_value_tree (widget_value *wv)
if (!wv)
return;
free (wv->name);
free (wv->value);
free (wv->key);
xfree (wv->name);
xfree (wv->value);
xfree (wv->key);
wv->name = wv->value = wv->key = (char *) 0xDEADBEEF;
......@@ -281,7 +281,7 @@ free_widget_info (widget_info *info)
safe_free_str (info->name);
free_widget_value_tree (info->val);
memset ((void*)info, 0xDEADBEEF, sizeof (widget_info));
free (info);
xfree (info);
}
static void
......@@ -317,7 +317,7 @@ static void
free_widget_instance (widget_instance *instance)
{
memset ((void*)instance, 0xDEADBEEF, sizeof (widget_instance));
free (instance);
xfree (instance);
}
static widget_info *
......@@ -602,7 +602,7 @@ name_to_widget (widget_instance *instance, const char *name)
widget = XtNameToWidget (instance->widget, real_name);
free (real_name);
xfree (real_name);
}
return widget;
}
......
......@@ -1891,7 +1891,7 @@ openXftFont (XlwMenuWidget mw)
}
}
if (fname != mw->menu.fontName) free (fname);
if (fname != mw->menu.fontName) xfree (fname);
return mw->menu.xft_font != 0;
}
......
2011-10-13 Dmitry Antipov <dmantipov@yandex.ru>
* editfns.c (Fset_time_zone_rule): Replace free with xfree to
avoid crash when xmalloc overrun checking is enabled.
2011-10-13 Eli Zaretskii <eliz@gnu.org>
* xdisp.c (Fcurrent_bidi_paragraph_direction): Initialize
......
......@@ -2079,7 +2079,7 @@ only the former. */)
}
set_time_zone_rule (tzstring);
free (environbuf);
xfree (environbuf);
environbuf = environ;
return Qnil;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment