public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Cyril Hrubis <chrubis@suse.cz>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v2] msync04.c: Use direct IO to verify the data is stored on disk
Date: Mon, 17 Jun 2024 14:13:05 +0200	[thread overview]
Message-ID: <20240617121305.GA265101@pevik> (raw)
In-Reply-To: <Zmxhq-efWMJa5a-2@rei>

> Hi!
> > > +static void verify_mmaped(void)
> > > +{
> > > +	char *buffer = SAFE_MEMALIGN(getpagesize(), getpagesize());
> > > +
> > > +	tst_res(TINFO, "Haven't seen dirty bit so we check content of file instead");
> > > +	test_fd = SAFE_OPEN("msync04/testfile", O_RDONLY | O_DIRECT);
> > If this fails we have memory leak, because free() is not run.

> > > +	SAFE_READ(0, test_fd, buffer, getpagesize());
> > Also here. Maybe create buf as static and have conditional free() also at the
> > cleanup?

> If these fail we exit the test, which frees memory anyways...

Thanks for correcting me.  I always forget the basis that exit() frees the
memory (unlike return 0 and unless overwritten). And we call exit() in
tst_brk().

Kind regards,
Petr

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

  reply	other threads:[~2024-06-17 12:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-30  4:40 [LTP] [PATCH v1] msync04.c: Use direct IO to verify the data is stored on disk Wei Gao via ltp
2024-05-30  8:39 ` Jan Kara
2024-06-13  8:31 ` Cyril Hrubis
2024-06-13 23:20 ` [LTP] [PATCH v2] " Wei Gao via ltp
2024-06-14 12:51   ` Petr Vorel
2024-06-14 15:28     ` Cyril Hrubis
2024-06-17 12:13       ` Petr Vorel [this message]
2024-06-17 10:13   ` Petr Vorel

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=20240617121305.GA265101@pevik \
    --to=pvorel@suse.cz \
    --cc=chrubis@suse.cz \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox