Re: Memory leak in 0.17.1

From: Ulric Eriksson <ulric_at_siag.nu>
Date: Mon, 27 Aug 2007 10:38:19 +0200 (CEST)

On Mon, 27 Aug 2007, Nigel Horne wrote:

> If realloc fails, pen_realloc returns NULL.
>
> In this circumstance there is a memory leak at
> acls[a] = pen_realloc(acls[a], nacls[a]*sizeof(acl));
>
> Since the *old* value of acls[a] is never freed.
> I suspect that this is because of the common misunderstanding that is
> foo = realloc(bar, 256)
> returns NULL that bar is freed. It isn't.
>
> Furthermore, is pen_realloc fails something is really wrong and it's quite
> possible that error("Can't realloc %ld bytes", (long)n); will also fail, so
> the program ought to die.

If realloc fails, pen_realloc calls error() which calls exit()
after trying to log an error message.

Ulric
Received on Mon Aug 27 2007 - 10:38:20 CEST

This archive was generated by hypermail 2.2.0 : Mon Aug 27 2007 - 10:38:21 CEST