# HG changeset patch # User Karl Heuer # Date 798325441 0 # Node ID db02849ee365553a314666e7fdaaf804ee3a22fa # Parent da1a40d86231f4a62916ab1fa38d99be31c35fe0 (x_window): Use (or reuse) frame's namebuf instead of a temp var. This avoids a storage leak. diff -r da1a40d86231 -r db02849ee365 src/xfns.c --- a/src/xfns.c Wed Apr 19 20:58:28 1995 +0000 +++ b/src/xfns.c Wed Apr 19 21:04:01 1995 +0000 @@ -2325,27 +2325,21 @@ Widget shell_widget; Widget pane_widget; Widget frame_widget; - char* name; Arg al [25]; int ac; BLOCK_INPUT; - if (STRINGP (f->name)) - { - /* This is a storage leak, but unless people create - thousands of frames, that's ok. - Fix it later by making a new slot in the frame to hold this. */ - name = (char *) xmalloc (XSTRING (f->name)->size + 1); - bcopy (XSTRING (f->name)->data, name, XSTRING (f->name)->size + 1); - } - else - name = "emacs"; + { + char *str = (STRINGP (f->name) ? XSTRING (f->name)->data : "emacs"); + f->namebuf = (char *) xrealloc (f->namebuf, strlen (str) + 1); + strcpy (f->namebuf, str); + } ac = 0; XtSetArg (al[ac], XtNallowShellResize, 1); ac++; XtSetArg (al[ac], XtNinput, 1); ac++; - shell_widget = XtAppCreateShell (name, EMACS_CLASS, + shell_widget = XtAppCreateShell (f->namebuf, EMACS_CLASS, topLevelShellWidgetClass, FRAME_X_DISPLAY (f), al, ac); @@ -2373,7 +2367,7 @@ XtSetArg (al[ac], XtNallowResize, 1); ac++; XtSetArg (al[ac], XtNresizeToPreferred, 1); ac++; XtSetArg (al[ac], XtNemacsFrame, f); ac++; - frame_widget = XtCreateWidget (name, + frame_widget = XtCreateWidget (f->namebuf, emacsFrameClass, pane_widget, al, ac); lw_set_main_areas (pane_widget, f->display.x->menubar_widget, frame_widget);