All of lore.kernel.org
 help / color / mirror / Atom feed
* [2.6 patch] acpi_ns_get_external_pathname(): fix a memory leak
@ 2008-08-27 22:03 Adrian Bunk
  2008-08-28 19:36 ` Moore, Robert
  0 siblings, 1 reply; 3+ messages in thread
From: Adrian Bunk @ 2008-08-27 22:03 UTC (permalink / raw)
  To: Bob Moore, Lin Ming, Andi Kleen, lenb; +Cc: linux-acpi

This patch fixes a memory leak in an error path.

Reported-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: Adrian Bunk <bunk@kernel.org>

---
446be2de05a8c1fbf2208311673a19aaf26b188e 
diff --git a/drivers/acpi/namespace/nsnames.c b/drivers/acpi/namespace/nsnames.c
index bd57738..f03410c 100644
--- a/drivers/acpi/namespace/nsnames.c
+++ b/drivers/acpi/namespace/nsnames.c
@@ -150,20 +150,21 @@ char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node)
 	name_buffer = ACPI_ALLOCATE_ZEROED(size);
 	if (!name_buffer) {
 		ACPI_ERROR((AE_INFO, "Allocation failure"));
 		return_PTR(NULL);
 	}
 
 	/* Build the path in the allocated buffer */
 
 	status = acpi_ns_build_external_path(node, size, name_buffer);
 	if (ACPI_FAILURE(status)) {
+		ACPI_FREE(name_buffer);
 		return (NULL);
 	}
 
 	return_PTR(name_buffer);
 }
 #endif
 
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_get_pathname_length

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

* RE: [2.6 patch] acpi_ns_get_external_pathname(): fix a memory leak
  2008-08-27 22:03 [2.6 patch] acpi_ns_get_external_pathname(): fix a memory leak Adrian Bunk
@ 2008-08-28 19:36 ` Moore, Robert
  2008-08-28 20:46   ` Andi Kleen
  0 siblings, 1 reply; 3+ messages in thread
From: Moore, Robert @ 2008-08-28 19:36 UTC (permalink / raw)
  To: Adrian Bunk, Lin, Ming M, Andi Kleen, lenb@kernel.org
  Cc: linux-acpi@vger.kernel.org

I have added this to acpica, available in the next release.
Rather than patch linux now, I suggest waiting until it bubbles up from the ACPICA->Linux process.

Bob


>-----Original Message-----
>From: Adrian Bunk [mailto:bunk@kernel.org]
>Sent: Wednesday, August 27, 2008 3:03 PM
>To: Moore, Robert; Lin, Ming M; Andi Kleen; lenb@kernel.org
>Cc: linux-acpi@vger.kernel.org
>Subject: [2.6 patch] acpi_ns_get_external_pathname(): fix a memory leak
>
>This patch fixes a memory leak in an error path.
>
>Reported-by: Adrian Bunk <bunk@kernel.org>
>Signed-off-by: Adrian Bunk <bunk@kernel.org>
>
>---
>446be2de05a8c1fbf2208311673a19aaf26b188e
>diff --git a/drivers/acpi/namespace/nsnames.c
>b/drivers/acpi/namespace/nsnames.c
>index bd57738..f03410c 100644
>--- a/drivers/acpi/namespace/nsnames.c
>+++ b/drivers/acpi/namespace/nsnames.c
>@@ -150,20 +150,21 @@ char *acpi_ns_get_external_pathname(struct
>acpi_namespace_node *node)
>        name_buffer = ACPI_ALLOCATE_ZEROED(size);
>        if (!name_buffer) {
>                ACPI_ERROR((AE_INFO, "Allocation failure"));
>                return_PTR(NULL);
>        }
>
>        /* Build the path in the allocated buffer */
>
>        status = acpi_ns_build_external_path(node, size, name_buffer);
>        if (ACPI_FAILURE(status)) {
>+               ACPI_FREE(name_buffer);
>                return (NULL);
>        }
>
>        return_PTR(name_buffer);
> }
> #endif
>
>
>/**************************************************************************
>*****
>  *
>  * FUNCTION:    acpi_ns_get_pathname_length

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

* Re: [2.6 patch] acpi_ns_get_external_pathname(): fix a memory leak
  2008-08-28 19:36 ` Moore, Robert
@ 2008-08-28 20:46   ` Andi Kleen
  0 siblings, 0 replies; 3+ messages in thread
From: Andi Kleen @ 2008-08-28 20:46 UTC (permalink / raw)
  To: Moore, Robert
  Cc: Adrian Bunk, Lin, Ming M, lenb@kernel.org,
	linux-acpi@vger.kernel.org

Moore, Robert wrote:
> I have added this to acpica, available in the next release.
> Rather than patch linux now, I suggest waiting until it bubbles up from the ACPICA->Linux process.

Ok I will wait for that.

-Andi

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

end of thread, other threads:[~2008-08-28 20:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-27 22:03 [2.6 patch] acpi_ns_get_external_pathname(): fix a memory leak Adrian Bunk
2008-08-28 19:36 ` Moore, Robert
2008-08-28 20:46   ` Andi Kleen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.