Subject: oddity in windows.c:do_windowlist()

From: "Paul D. Smith" <[email-masked]>
Date: Tue, 1 Dec 1998 21:42:04 -0800 (PST)

I'm cleaning up lots and lots of memory leaks I found after commenting
out the Recapture and Destroy sections of the Purify test, and I ran
across something odd in windows.c:do_windowlist().

See this code:

  char *tfunc=NULL;
    ...
        if (func)
	{
	  tfunc = safemalloc(strlen(func) + 32);
          sprintf(tlabel,"%s %ld",func,t->w);
	  free(func);
	  func = NULL;
	}
        else
	{
	  tfunc = safemalloc(40);
          sprintf(tlabel,"WindowListFunc %ld",t->w);
	}
	free(tfunc);

These are the _only_ references to tfunc anywhere in the function.  I
can't see any possible reason to be allocating that memory, or even to
have that variable exist at all.

Anyone else see anything?  Else I'll just remove it.

PS. This isn't a leak, I just noticed it and thought it was odd...

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <[email-masked]>         Network Management Development
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist
-------------------------------------------------------------------------------
   These are my opinions---Nortel Networks takes no responsibility for them.
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked].

---

From: Dominik Vogt <[email-masked]>
Date: Wed, 2 Dec 1998 12:11:22 +0100

> Anyone else see anything?  Else I'll just remove it.

Yup. That's a bug (which may cause a coredump). Two or three
people have been active in this function (on of them me), so
I think we mixed things up a bit. The sprintf's shouldn't
print into tlabel but into tfunc. The free has to be moved
(I think that was my doing while trying to fix leaks).

Can you make the changes?

Bye

Dominik
-- 
Dominik Vogt, Hewlett-Packard GmbH, Dept. BVS
Herrenberger Str.130, 71034 Boeblingen, Germany
phone: 07031/14-4596, fax: 07031/14-3883, [email-masked]
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked].

---

From: [email-masked] (Paul D. Smith)
Date: 02 Dec 1998 09:38:58 -0500

%% Dominik Vogt <[email-masked]> writes:

  dv> Yup. That's a bug (which may cause a coredump). Two or three
  dv> people have been active in this function (on of them me), so
  dv> I think we mixed things up a bit. The sprintf's shouldn't
  dv> print into tlabel but into tfunc. The free has to be moved
  dv> (I think that was my doing while trying to fix leaks).

OK, I see what needs to be done.