MOO-cows Mailing List Archive
[Prev][Next][Index][Thread]
Re: possible memory leak in 1.8.0p1
-
Date: Wed, 13 Mar 1996 12:13:05 PST
-
From: Pavel Curtis <pavel@parc.xerox.com>
-
cc: moo-cows.PARC@xerox.com
-
In-Reply-to: "Ahn Jin-su's message of \"Tue, 12 Mar 1996 22:54:40 PST\" <96Mar12.225728pst.\"14720(6)\"@alpha.xerox.com>M"
Ahn Jin-su writes:
> In utils.c, binary_to_raw_bytes():
>
> const char *ptr = binary;
>
> if (!s) <- why 'if (!s)'? Isn't s always zero?
> s = new_stream(100);
> else
> reset_stream(s);
The line you left out was the declaration of `s':
static Stream *s = 0;
Since `s' is static, it will not be zero on the second entry to this function.
> return 0; <- not freed Stream s...
It's not freed so that it can be reused on later calls without having to
allocate a new one each time. This idiom is used in many places throughout the
server. Arguably, this case isn't worth it, but... (*shrug*)
Pavel
Home |
Subject Index |
Thread Index