[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
tmpfile leaks
From: |
Andy Wingo |
Subject: |
tmpfile leaks |
Date: |
Fri, 29 Jul 2011 09:07:43 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) |
Coverity identified the following error:
> Error: RESOURCE_LEAK:
> /builddir/build/BUILD/guile-2.0.2/libguile/posix.c:1342: alloc_fn: Calling
> allocation function "tmpfile".
> /builddir/build/BUILD/guile-2.0.2/libguile/posix.c:1342: var_assign:
> Assigning: "rv" = storage returned from "tmpfile()".
> /builddir/build/BUILD/guile-2.0.2/libguile/posix.c:1344: noescape: Variable
> "rv" is not freed or pointed-to in function "fileno".
> /builddir/build/BUILD/guile-2.0.2/libguile/posix.c:1344: leaked_storage:
> Variable "rv" going out of scope leaks the storage it points to.
And indeed:
SCM_DEFINE (scm_tmpfile, "tmpfile", 0, 0, 0,
(void),
"Return an input/output port to a unique temporary file\n"
"named using the path prefix @code{P_tmpdir} defined in\n"
"@file{stdio.h}.\n"
"The file is automatically deleted when the port is closed\n"
"or the program terminates.")
#define FUNC_NAME s_scm_tmpfile
{
FILE *rv;
if (! (rv = tmpfile ()))
SCM_SYSERROR;
return scm_fdes_to_port (fileno (rv), "w+", SCM_BOOL_F);
}
#undef FUNC_NAME
What should we do here?
Andy
--
http://wingolog.org/
- tmpfile leaks,
Andy Wingo <=