public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ACPI, psargs: Fix small mem leaks on error paths
@ 2012-02-05  1:12 Jesper Juhl
  2012-03-19 22:11 ` Jesper Juhl
  2012-03-30  7:11 ` Len Brown
  0 siblings, 2 replies; 4+ messages in thread
From: Jesper Juhl @ 2012-02-05  1:12 UTC (permalink / raw)
  To: linux-acpi; +Cc: linux-kernel, Bob Moore, Lin Ming, Len Brown

As far as I can see, there are two small mem leaks in error paths of
'acpi_ps_get_next_field()' where we neglect to free the memory
previously allocated to 'field'.

I believe this patch should fix the leaks.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
 drivers/acpi/acpica/psargs.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

 Note: Compile tested only.

diff --git a/drivers/acpi/acpica/psargs.c b/drivers/acpi/acpica/psargs.c
index 5ac36ab..a683d66 100644
--- a/drivers/acpi/acpica/psargs.c
+++ b/drivers/acpi/acpica/psargs.c
@@ -618,6 +618,7 @@ static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state
 
 				arg = acpi_ps_alloc_op(AML_INT_BYTELIST_OP);
 				if (!arg) {
+					acpi_ps_free_op(field);
 					return_PTR(NULL);
 				}
 
@@ -662,6 +663,7 @@ static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state
 		} else {
 			arg = acpi_ps_alloc_op(AML_INT_NAMEPATH_OP);
 			if (!arg) {
+				acpi_ps_free_op(field);
 				return_PTR(NULL);
 			}
 
-- 
1.7.9


-- 
Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] ACPI, psargs: Fix small mem leaks on error paths
  2012-02-05  1:12 [PATCH] ACPI, psargs: Fix small mem leaks on error paths Jesper Juhl
@ 2012-03-19 22:11 ` Jesper Juhl
  2012-03-30  7:11 ` Len Brown
  1 sibling, 0 replies; 4+ messages in thread
From: Jesper Juhl @ 2012-03-19 22:11 UTC (permalink / raw)
  To: linux-acpi; +Cc: linux-kernel, Bob Moore, Lin Ming, Len Brown

Ping?

On Sun, 5 Feb 2012, Jesper Juhl wrote:

> As far as I can see, there are two small mem leaks in error paths of
> 'acpi_ps_get_next_field()' where we neglect to free the memory
> previously allocated to 'field'.
> 
> I believe this patch should fix the leaks.
> 
> Signed-off-by: Jesper Juhl <jj@chaosbits.net>
> ---
>  drivers/acpi/acpica/psargs.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
>  Note: Compile tested only.
> 
> diff --git a/drivers/acpi/acpica/psargs.c b/drivers/acpi/acpica/psargs.c
> index 5ac36ab..a683d66 100644
> --- a/drivers/acpi/acpica/psargs.c
> +++ b/drivers/acpi/acpica/psargs.c
> @@ -618,6 +618,7 @@ static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state
>  
>  				arg = acpi_ps_alloc_op(AML_INT_BYTELIST_OP);
>  				if (!arg) {
> +					acpi_ps_free_op(field);
>  					return_PTR(NULL);
>  				}
>  
> @@ -662,6 +663,7 @@ static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state
>  		} else {
>  			arg = acpi_ps_alloc_op(AML_INT_NAMEPATH_OP);
>  			if (!arg) {
> +				acpi_ps_free_op(field);
>  				return_PTR(NULL);
>  			}
>  
> 

-- 
Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ACPI, psargs: Fix small mem leaks on error paths
  2012-02-05  1:12 [PATCH] ACPI, psargs: Fix small mem leaks on error paths Jesper Juhl
  2012-03-19 22:11 ` Jesper Juhl
@ 2012-03-30  7:11 ` Len Brown
  2012-03-31  0:56   ` Lin Ming
  1 sibling, 1 reply; 4+ messages in thread
From: Len Brown @ 2012-03-30  7:11 UTC (permalink / raw)
  To: Bob Moore; +Cc: Jesper Juhl, linux-acpi, linux-kernel, Lin Ming

Bob?

On 02/04/2012 08:12 PM, Jesper Juhl wrote:

> As far as I can see, there are two small mem leaks in error paths of
> 'acpi_ps_get_next_field()' where we neglect to free the memory
> previously allocated to 'field'.
> 
> I believe this patch should fix the leaks.
> 
> Signed-off-by: Jesper Juhl <jj@chaosbits.net>
> ---
>  drivers/acpi/acpica/psargs.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
>  Note: Compile tested only.
> 
> diff --git a/drivers/acpi/acpica/psargs.c b/drivers/acpi/acpica/psargs.c
> index 5ac36ab..a683d66 100644
> --- a/drivers/acpi/acpica/psargs.c
> +++ b/drivers/acpi/acpica/psargs.c
> @@ -618,6 +618,7 @@ static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state
>  
>  				arg = acpi_ps_alloc_op(AML_INT_BYTELIST_OP);
>  				if (!arg) {
> +					acpi_ps_free_op(field);
>  					return_PTR(NULL);
>  				}
>  
> @@ -662,6 +663,7 @@ static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state
>  		} else {
>  			arg = acpi_ps_alloc_op(AML_INT_NAMEPATH_OP);
>  			if (!arg) {
> +				acpi_ps_free_op(field);
>  				return_PTR(NULL);
>  			}
>  



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ACPI, psargs: Fix small mem leaks on error paths
  2012-03-30  7:11 ` Len Brown
@ 2012-03-31  0:56   ` Lin Ming
  0 siblings, 0 replies; 4+ messages in thread
From: Lin Ming @ 2012-03-31  0:56 UTC (permalink / raw)
  To: Len Brown; +Cc: Bob Moore, Jesper Juhl, linux-acpi, linux-kernel

We have ported this patch into ACPICA tree.

On Fri, 2012-03-30 at 03:11 -0400, Len Brown wrote:
> Bob?
> 
> On 02/04/2012 08:12 PM, Jesper Juhl wrote:
> 
> > As far as I can see, there are two small mem leaks in error paths of
> > 'acpi_ps_get_next_field()' where we neglect to free the memory
> > previously allocated to 'field'.
> > 
> > I believe this patch should fix the leaks.
> > 
> > Signed-off-by: Jesper Juhl <jj@chaosbits.net>
> > ---
> >  drivers/acpi/acpica/psargs.c |    2 ++
> >  1 files changed, 2 insertions(+), 0 deletions(-)
> > 
> >  Note: Compile tested only.
> > 
> > diff --git a/drivers/acpi/acpica/psargs.c b/drivers/acpi/acpica/psargs.c
> > index 5ac36ab..a683d66 100644
> > --- a/drivers/acpi/acpica/psargs.c
> > +++ b/drivers/acpi/acpica/psargs.c
> > @@ -618,6 +618,7 @@ static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state
> >  
> >  				arg = acpi_ps_alloc_op(AML_INT_BYTELIST_OP);
> >  				if (!arg) {
> > +					acpi_ps_free_op(field);
> >  					return_PTR(NULL);
> >  				}
> >  
> > @@ -662,6 +663,7 @@ static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state
> >  		} else {
> >  			arg = acpi_ps_alloc_op(AML_INT_NAMEPATH_OP);
> >  			if (!arg) {
> > +				acpi_ps_free_op(field);
> >  				return_PTR(NULL);
> >  			}
> >  
> 
> 



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-03-31  0:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-05  1:12 [PATCH] ACPI, psargs: Fix small mem leaks on error paths Jesper Juhl
2012-03-19 22:11 ` Jesper Juhl
2012-03-30  7:11 ` Len Brown
2012-03-31  0:56   ` Lin Ming

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox