{"id":812652,"url":"http://patchwork.ozlabs.org/api/patches/812652/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/patch/150516748034.6883.2205624415045931101.stgit@bahia.lan/","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/projects/14/?format=json","name":"QEMU Development","link_name":"qemu-devel","list_id":"qemu-devel.nongnu.org","list_email":"qemu-devel@nongnu.org","web_url":"","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<150516748034.6883.2205624415045931101.stgit@bahia.lan>","list_archive_url":null,"date":"2017-09-11T22:04:40","name":"xics: fix several error leaks","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"0c64bbe41cd27afa82e1ae8693e9966be7b41d01","submitter":{"id":69178,"url":"http://patchwork.ozlabs.org/api/people/69178/?format=json","name":"Greg Kurz","email":"groug@kaod.org"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/qemu-devel/patch/150516748034.6883.2205624415045931101.stgit@bahia.lan/mbox/","series":[{"id":2589,"url":"http://patchwork.ozlabs.org/api/series/2589/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/list/?series=2589","date":"2017-09-11T22:04:40","name":"xics: fix several error leaks","version":1,"mbox":"http://patchwork.ozlabs.org/series/2589/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/812652/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/812652/checks/","tags":{},"related":[],"headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xrhnS5hGZz9s7F\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 12 Sep 2017 08:05:32 +1000 (AEST)","from localhost ([::1]:60816 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1drWpe-00083g-Rg\n\tfor incoming@patchwork.ozlabs.org; Mon, 11 Sep 2017 18:05:30 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:53262)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <groug@kaod.org>) id 1drWp1-00080U-12\n\tfor qemu-devel@nongnu.org; Mon, 11 Sep 2017 18:04:56 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <groug@kaod.org>) id 1drWow-0006JS-VI\n\tfor qemu-devel@nongnu.org; Mon, 11 Sep 2017 18:04:51 -0400","from 15.mo1.mail-out.ovh.net ([188.165.38.232]:36492)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <groug@kaod.org>) id 1drWow-0006JI-P5\n\tfor qemu-devel@nongnu.org; Mon, 11 Sep 2017 18:04:46 -0400","from player169.ha.ovh.net (b9.ovh.net [213.186.33.59])\n\tby mo1.mail-out.ovh.net (Postfix) with ESMTP id F0521917B0\n\tfor <qemu-devel@nongnu.org>; Tue, 12 Sep 2017 00:04:44 +0200 (CEST)","from bahia.lan (gar31-1-82-66-74-139.fbx.proxad.net [82.66.74.139])\n\t(Authenticated sender: groug@kaod.org)\n\tby player169.ha.ovh.net (Postfix) with ESMTPA id 979F458007C;\n\tTue, 12 Sep 2017 00:04:40 +0200 (CEST)"],"From":"Greg Kurz <groug@kaod.org>","To":"qemu-devel@nongnu.org","Date":"Tue, 12 Sep 2017 00:04:40 +0200","Message-ID":"<150516748034.6883.2205624415045931101.stgit@bahia.lan>","User-Agent":"StGit/0.17.1-46-g6855-dirty","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"7bit","X-Ovh-Tracer-Id":"611363651135117707","X-VR-SPAMSTATE":"OK","X-VR-SPAMSCORE":"-100","X-VR-SPAMCAUSE":"gggruggvucftvghtrhhoucdtuddrfeelledrgedtgddujeegucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddm","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]","X-Received-From":"188.165.38.232","Subject":"[Qemu-devel] [PATCH] xics: fix several error leaks","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"qemu-ppc@nongnu.org, Cedric Le Goater <clg@kaod.org>,\n\tDavid Gibson <david@gibson.dropbear.id.au>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"},"content":"If object_property_get_link() fails then it allocates an error, which\nmust be freed before returning. The error_get_pretty() function is\nmerely an accessor to the error message and doesn't free anything.\n\nThe error.h header indicates how to do it right:\n\n * Pass an existing error to the caller with the message modified:\n *     error_propagate(errp, err);\n *     error_prepend(errp, \"Could not frobnicate '%s': \", name);\n\nSigned-off-by: Greg Kurz <groug@kaod.org>\n---\n hw/intc/xics.c |   12 ++++++------\n 1 file changed, 6 insertions(+), 6 deletions(-)","diff":"diff --git a/hw/intc/xics.c b/hw/intc/xics.c\nindex a84ba51ad8ff..80c33be02e5e 100644\n--- a/hw/intc/xics.c\n+++ b/hw/intc/xics.c\n@@ -306,8 +306,8 @@ static void icp_realize(DeviceState *dev, Error **errp)\n \n     obj = object_property_get_link(OBJECT(dev), ICP_PROP_XICS, &err);\n     if (!obj) {\n-        error_setg(errp, \"%s: required link '\" ICP_PROP_XICS \"' not found: %s\",\n-                   __func__, error_get_pretty(err));\n+        error_propagate(errp, err);\n+        error_prepend(errp, \"required link '\" ICP_PROP_XICS \"' not found: \");\n         return;\n     }\n \n@@ -315,8 +315,8 @@ static void icp_realize(DeviceState *dev, Error **errp)\n \n     obj = object_property_get_link(OBJECT(dev), ICP_PROP_CPU, &err);\n     if (!obj) {\n-        error_setg(errp, \"%s: required link '\" ICP_PROP_CPU \"' not found: %s\",\n-                   __func__, error_get_pretty(err));\n+        error_propagate(errp, err);\n+        error_prepend(errp, \"required link '\" ICP_PROP_CPU \"' not found: \");\n         return;\n     }\n \n@@ -641,8 +641,8 @@ static void ics_base_realize(DeviceState *dev, Error **errp)\n \n     obj = object_property_get_link(OBJECT(dev), ICS_PROP_XICS, &err);\n     if (!obj) {\n-        error_setg(errp, \"%s: required link '\" ICS_PROP_XICS \"' not found: %s\",\n-                   __func__, error_get_pretty(err));\n+        error_propagate(errp, err);\n+        error_prepend(errp, \"required link '\" ICS_PROP_XICS \"' not found: \");\n         return;\n     }\n     ics->xics = XICS_FABRIC(obj);\n","prefixes":[]}