All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Bogdan Lezhepekov <blezhepekov@suse.de>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v2] lib/safe_file_ops.c: Fix resource leak
Date: Wed, 16 Feb 2022 09:51:06 +0100	[thread overview]
Message-ID: <Ygy6+t3MqaamDtlS@pevik> (raw)
In-Reply-To: <20220216074800.22621-1-blezhepekov@suse.de>

Hi Bogdan,

> safe_file_scanf and safe_file_vprintf suffered
> from resource leak, as opened file descriptor
> was not closed in case of error.
I guess we don't care about closing file descriptor in both safe_file_scanf()
and safe_file_vprintf() because test exits due used tst_brkm_().

And we *do* care in file_printf() with err: label because we don't exit there
(tst_resm_() does not exit).

But instead, you could replace fopen() / fclose() which is followed by
tst_brkm_() by safe_fopen() / safe_fclose() (to shorten the code).

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

      reply	other threads:[~2022-02-16  8:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-16  7:48 [LTP] [PATCH v2] lib/safe_file_ops.c: Fix resource leak Bogdan Lezhepekov
2022-02-16  8:51 ` Petr Vorel [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Ygy6+t3MqaamDtlS@pevik \
    --to=pvorel@suse.cz \
    --cc=blezhepekov@suse.de \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.