summaryrefslogtreecommitdiff
path: root/lwlib
diff options
context:
space:
mode:
authorDmitry Antipov <dmantipov@yandex.ru>2011-10-13 07:55:46 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2011-10-13 07:55:46 -0700
commit81d40c920807279ccc0dae0aca46c8291755c66d (patch)
tree8770bfd02923e8b930aec16401eeb16f3fb6fbe4 /lwlib
parente7e2364b7ba0293fb4b6f8ae3e38127e84dafe8b (diff)
downloademacs-81d40c920807279ccc0dae0aca46c8291755c66d.tar.gz
Use xfree, not free, to avoid crash with --enable-checking=xmallocoverrun.
Diffstat (limited to 'lwlib')
-rw-r--r--lwlib/ChangeLog10
-rw-r--r--lwlib/lwlib-Xaw.c4
-rw-r--r--lwlib/lwlib-Xm.c12
-rw-r--r--lwlib/lwlib-utils.c2
-rw-r--r--lwlib/lwlib.c16
-rw-r--r--lwlib/xlwmenu.c2
6 files changed, 28 insertions, 18 deletions
diff --git a/lwlib/ChangeLog b/lwlib/ChangeLog
index 7e332a9fd5d..3b494865f0c 100644
--- a/lwlib/ChangeLog
+++ b/lwlib/ChangeLog
@@ -1,3 +1,13 @@
+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
diff --git a/lwlib/lwlib-Xaw.c b/lwlib/lwlib-Xaw.c
index 9c9a007bc15..0eea0aba7b6 100644
--- a/lwlib/lwlib-Xaw.c
+++ b/lwlib/lwlib-Xaw.c
@@ -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))
diff --git a/lwlib/lwlib-Xm.c b/lwlib/lwlib-Xm.c
index 2b7677a02f5..058e2e779c7 100644
--- a/lwlib/lwlib-Xm.c
+++ b/lwlib/lwlib-Xm.c
@@ -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));
}
}
diff --git a/lwlib/lwlib-utils.c b/lwlib/lwlib-utils.c
index 7a0dd1b264a..fe236a210f3 100644
--- a/lwlib/lwlib-utils.c
+++ b/lwlib/lwlib-utils.c
@@ -80,7 +80,7 @@ XtApplyToWidgets (Widget w, XtApplyToWidgetsProc proc, XtPointer arg)
XtApplyToWidgets (kids [i], proc, arg);
proc (kids [i], arg);
}
- free (kids);
+ xfree (kids);
}
}
diff --git a/lwlib/lwlib.c b/lwlib/lwlib.c
index 9d8ec3330d3..7e3538aec04 100644
--- a/lwlib/lwlib.c
+++ b/lwlib/lwlib.c
@@ -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;
}
diff --git a/lwlib/xlwmenu.c b/lwlib/xlwmenu.c
index e9ec604ae7f..5ed33d5be05 100644
--- a/lwlib/xlwmenu.c
+++ b/lwlib/xlwmenu.c
@@ -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;
}