[2.6 patch] acpi_ns_get_external_pathname(): fix a memory leak

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch fixes a memory leak in an error path.

Reported-by: Adrian Bunk <bunk@xxxxxxxxxx>
Signed-off-by: Adrian Bunk <bunk@xxxxxxxxxx>

---
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
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux