Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1314161
| From | Matt Fleming <matt@console-pimps.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v10 1/1] efi: a misc char interface for user to update efi firmware |
| Date | 2016-01-21 13:40 +0100 |
| Message-ID | <qTmGS-5g3-19@gated-at.bofh.it> (permalink) |
| References | <qH2aR-5vD-5@gated-at.bofh.it> <qH2aR-5vD-3@gated-at.bofh.it> <qIc89-Ry-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Mon, 21 Dec, at 05:04:11PM, Bryan O'Donoghue wrote:
> > +static int efi_capsule_open(struct inode *inode, struct file *file)
> > +{
> > + struct capsule_info *cap_info;
> > +
> > + cap_info = kzalloc(sizeof(*cap_info), GFP_KERNEL);
> > + if (!cap_info)
> > + return -ENOMEM;
> > +
> > + file->private_data = cap_info;
> > +
> > + return 0;
> > +}
>
> You have a memory leak here don't you ?
>
> if I do
> for (i = 0; i < N; i++) {
> fd = open(/dev/your_node);
> close(fd);
> }
>
> You'll leak that kzalloc...
Nope, it gets freed in efi_capsule_release(). Though the code does
leak cap_info->pages if a capsule is successfully submitted to the
firmware.
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
Re: [PATCH v10 1/1] efi: a misc char interface for user to update efi firmware Matt Fleming <matt@console-pimps.org> - 2016-01-21 13:40 +0100
csiph-web