ACPICA: Fix possible memory leak in acpi_ns_get_external_pathname
authorBob Moore <robert.moore@intel.com>
Sat, 27 Sep 2008 03:12:36 +0000 (11:12 +0800)
committerLen Brown <len.brown@intel.com>
Thu, 23 Oct 2008 03:14:45 +0000 (23:14 -0400)
Fixes a memory leak in the error exit path.

Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lin Ming <ming.m.lin@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
drivers/acpi/namespace/nsnames.c

index bd57738..9c587bd 100644 (file)
@@ -142,7 +142,7 @@ char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node)
 
        size = acpi_ns_get_pathname_length(node);
        if (!size) {
-               return (NULL);
+               return_PTR(NULL);
        }
 
        /* Allocate a buffer to be returned to caller */
@@ -157,7 +157,8 @@ char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node)
 
        status = acpi_ns_build_external_path(node, size, name_buffer);
        if (ACPI_FAILURE(status)) {
-               return (NULL);
+               ACPI_FREE(name_buffer);
+               return_PTR(NULL);
        }
 
        return_PTR(name_buffer);