mirror of
git://git.gnupg.org/gnupg.git
synced 2025-02-21 19:48:05 +01:00
common/iobuf.c: Don't abort freeing a pipeline if freeing a filter fails
* common/iobuf.c (iobuf_cancel): Don't abort freeing a pipeline if freeing a filter fails. This needs to a memory leak. Instead, keep freeing and return the error code of the first filter that fails. -- Signed-off-by: Neal H. Walfield <neal@g10code.com>.
This commit is contained in:
parent
a250f73783
commit
1f94646a86
@ -1133,13 +1133,16 @@ iobuf_alloc (int use, size_t bufsize)
|
||||
int
|
||||
iobuf_close (iobuf_t a)
|
||||
{
|
||||
iobuf_t a2;
|
||||
iobuf_t a_chain;
|
||||
size_t dummy_len = 0;
|
||||
int rc = 0;
|
||||
|
||||
for (; a && !rc; a = a2)
|
||||
for (; a; a = a_chain)
|
||||
{
|
||||
a2 = a->chain;
|
||||
int rc2 = 0;
|
||||
|
||||
a_chain = a->chain;
|
||||
|
||||
if (a->use == IOBUF_OUTPUT && (rc = iobuf_flush (a)))
|
||||
log_error ("iobuf_flush failed on close: %s\n", gpg_strerror (rc));
|
||||
|
||||
@ -1147,9 +1150,14 @@ iobuf_close (iobuf_t a)
|
||||
log_debug ("iobuf-%d.%d: close '%s'\n",
|
||||
a->no, a->subno, iobuf_desc (a));
|
||||
|
||||
if (a->filter && (rc = a->filter (a->filter_ov, IOBUFCTRL_FREE,
|
||||
a->chain, NULL, &dummy_len)))
|
||||
if (a->filter && (rc2 = a->filter (a->filter_ov, IOBUFCTRL_FREE,
|
||||
a->chain, NULL, &dummy_len)))
|
||||
log_error ("IOBUFCTRL_FREE failed on close: %s\n", gpg_strerror (rc));
|
||||
if (! rc && rc2)
|
||||
/* Whoops! An error occured. Save it in RC if we haven't
|
||||
already recorded an error. */
|
||||
rc = rc2;
|
||||
|
||||
xfree (a->real_fname);
|
||||
if (a->d.buf)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user