From patchwork Wed Nov 11 23:48:17 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stewart Smith X-Patchwork-Id: 543153 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 96FC31402B9 for ; Thu, 12 Nov 2015 10:48:45 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 6409B1A027B for ; Thu, 12 Nov 2015 10:48:45 +1100 (AEDT) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from e17.ny.us.ibm.com (e17.ny.us.ibm.com [129.33.205.207]) (using TLSv1 with cipher CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 712BB1A018C for ; Thu, 12 Nov 2015 10:48:37 +1100 (AEDT) Received: from localhost by e17.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 11 Nov 2015 18:48:35 -0500 Received: from d01dlp01.pok.ibm.com (9.56.250.166) by e17.ny.us.ibm.com (146.89.104.204) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 11 Nov 2015 18:48:33 -0500 X-IBM-Helo: d01dlp01.pok.ibm.com X-IBM-MailFrom: stewart@linux.vnet.ibm.com X-IBM-RcptTo: skiboot@lists.ozlabs.org Received: from b01cxnp23032.gho.pok.ibm.com (b01cxnp23032.gho.pok.ibm.com [9.57.198.27]) by d01dlp01.pok.ibm.com (Postfix) with ESMTP id B357238C8039 for ; Wed, 11 Nov 2015 18:48:32 -0500 (EST) Received: from d01av02.pok.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) by b01cxnp23032.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id tABNmWYe56557810 for ; Wed, 11 Nov 2015 23:48:32 GMT Received: from d01av02.pok.ibm.com (localhost [127.0.0.1]) by d01av02.pok.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id tABNmWXR030174 for ; Wed, 11 Nov 2015 18:48:32 -0500 Received: from oc8180480414.ibm.com ([9.83.5.32]) by d01av02.pok.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with SMTP id tABNmMsj029769; Wed, 11 Nov 2015 18:48:31 -0500 Received: from ka1.ozlabs.ibm.com (localhost [127.0.0.1]) by oc8180480414.ibm.com (Postfix) with ESMTP id 4BECE3932; Thu, 12 Nov 2015 10:48:20 +1100 (AEDT) From: Stewart Smith To: skiboot@lists.ozlabs.org Date: Thu, 12 Nov 2015 10:48:17 +1100 Message-Id: <1447285697-19722-1-git-send-email-stewart@linux.vnet.ibm.com> X-Mailer: git-send-email 2.1.4 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15111123-0041-0000-0000-00000250CEAE Subject: [Skiboot] [PATCH] Fix resource leak on crash (similar to 125f95e) X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" The error paths here are a bit suspicious anyway as we're allocating memory in a failure path for having failed to allocate memory. One can hope that the memory allocated to display the error is less than the memory we attempted to allocate in the first place. Signed-off-by: Stewart Smith --- core/device.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/device.c b/core/device.c index 89e530f26554..c5f863454983 100644 --- a/core/device.c +++ b/core/device.c @@ -321,8 +321,10 @@ static struct dt_property *new_property(struct dt_node *node, char *path; if (!p) { + path = dt_get_path(node); prerror("Failed to allocate property \"%s\" for %s of %zu bytes\n", - name, dt_get_path(node), size); + name, path, size); + free(path); abort(); } if (dt_find_property(node, name)) {