[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <86802c440707192120v6b6de39ek811e4f7aed9faa45@mail.gmail.com>
Date: Thu, 19 Jul 2007 21:20:08 -0700
From: "Yinghai Lu" <yhlu.kernel@...il.com>
To: "Satyam Sharma" <satyam.sharma@...il.com>
Cc: "Reiner Sailer" <sailer@...ibm.com>,
"Jesper Juhl" <jesper.juhl@...il.com>, kjhall@...ux.vnet.ibm.com,
"Linux Kernel Mailing List" <linux-kernel@...r.kernel.org>,
"Seiji Munetoh" <munetoh@...ibm.com>,
"Reiner Sailer" <sailer@...son.ibm.com>, stefanb@...ibm.com
Subject: Re: [PATCH] Memory leak in tpm_ascii_bios_measurements_open() fix.
On 7/19/07, Satyam Sharma <satyam.sharma@...il.com> wrote:
> On 7/20/07, Reiner Sailer <sailer@...ibm.com> wrote:
> >
> > Jesper Juhl <jesper.juhl@...il.com> wrote on 07/18/2007 07:11:54 PM:
> > >
> > > +++ b/drivers/char/tpm/tpm_bios.c
> > > @@ -427,7 +427,7 @@ static int
> > > tpm_ascii_bios_measurements_open(struct inode *inode,
> > > return -ENOMEM;
> > >
> > > if ((err = read_log(log)))
> > > - return err;
> > > + goto out_free;
> > >
> > > /* now register seq file */
> > > err = seq_open(file, &tpm_ascii_b_measurments_seqops);
> > > @@ -435,10 +435,15 @@ static int
> > > tpm_ascii_bios_measurements_open(struct inode *inode,
> > > seq = file->private_data;
> > > seq->private = log;
> > > } else {
> > > - kfree(log->bios_event_log);
> > > - kfree(log);
> > > + goto out_free;
> > > }
> > > +
> > > +out:
> > > return err;
> > > +out_free:
> > > + kfree(log->bios_event_log);
> > > + kfree(log);
> > > + goto out;
> > > }
> > >
===>
out_free:
kfree(log->bios_event_log);
kfree(log);
out:
return err;
could kill one extra goto.
YH
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists