public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: Segmentation fault due to double free for archetype.
Date: Mon, 17 Jan 2022 16:47:35 +0100	[thread overview]
Message-ID: <YeWPlyHklwqrYH1j@calimero.vinschen.de> (raw)
In-Reply-To: <20220117214801.1f0d9bef92224cac51b6d806@nifty.ne.jp>

On Jan 17 21:48, Takashi Yano wrote:
> On Mon, 17 Jan 2022 13:11:46 +0100
> Corinna Vinschen wrote:
> >   if (!(res = (archetype && archetype->io_handle)
> >         || open (flags, mode & 07777)))
> > 
> > Then the archetype is one already created by a former open_with_arch
> > call and then you delete an archetype which is still in use, no?
> 
> archetype->usecount is not incremented yet here.
> archetype->usecount is incremented only when this 'if' clause
> is not true. So, isn't the following code right?
> 
>   if (!(res = (archetype && archetype->io_handle)
>         || open (flags, mode & 07777)))
>     {
>       if (archetype && archetype->usecount == 0)
>         cygheap->fdtab.delete_archetype (archetype);
>     }

Good point, yes, that sounds right to me.


Thanks,
Corinna

      reply	other threads:[~2022-01-17 15:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-15 10:20 Takashi Yano
2022-01-17 11:01 ` Corinna Vinschen
2022-01-17 11:41   ` Takashi Yano
2022-01-17 12:11     ` Corinna Vinschen
2022-01-17 12:48       ` Takashi Yano
2022-01-17 15:47         ` Corinna Vinschen [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=YeWPlyHklwqrYH1j@calimero.vinschen.de \
    --to=corinna-cygwin@cygwin.com \
    --cc=cygwin@cygwin.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).