From patchwork Tue Jul 14 16:42:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 277875 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0A02DC433E6 for ; Tue, 14 Jul 2020 16:44:05 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C8C5320656 for ; Tue, 14 Jul 2020 16:44:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="jxd6gKs3" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C8C5320656 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=amsat.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:50820 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jvO2F-0002ih-W8 for qemu-devel@archiver.kernel.org; Tue, 14 Jul 2020 12:44:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44138) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jvO1I-00013G-Bs for qemu-devel@nongnu.org; Tue, 14 Jul 2020 12:43:04 -0400 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]:45995) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jvO1G-0006oG-US for qemu-devel@nongnu.org; Tue, 14 Jul 2020 12:43:04 -0400 Received: by mail-wr1-x431.google.com with SMTP id s10so22944256wrw.12 for ; Tue, 14 Jul 2020 09:43:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2kQViIC5+9PvqKmlhSyw3D2e/Rk9cWBtF+16LewFggU=; b=jxd6gKs3gyaONVuseSojodyvFe3qXsF6x/Bgof5N2Wj5mE1QbICMH+enbg2fo97IS5 jtgFAUSWc2ag1dEharm7+nkB3dGofy4fhlaLUEr6ACHWuRDhIarece3UB5LCxgGuhff+ FTNS04qEnYLLvt7tde2vKrP0PMHcpSjJdPg+GOKgE2O6ZReQVpmRVT/4TGIcQkf9y237 P/BxwYTZ9Tx/1nt/3J+kZGIumE6Fjw1lU/nhCzQKwFREW0vfQh10SHKxymKjihmPXb+Z VO2b739GAZzT7Rat62zelLNHawrlTF+Oma7Jam4KNK6NhIdZdeLBPwkOlldMqaU5P905 6o3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=2kQViIC5+9PvqKmlhSyw3D2e/Rk9cWBtF+16LewFggU=; b=rhP0xLUDKXLE5tB9jTY0QWsj5oSKXAXk65o3wjD3ewCDYg2gOEm3iyTCp9/yVSOrlt MP5cChl7cKK7u8RvzkzQfe0m7WYywfSYxQSqOwaaPKbDCWslsfk9J02SaBRntvzsO82h bNjW1UcvxBJWrXRGPT4XJwQJoA90lOtlZ4DwuD2dRZXyy6qJYe0Opuhtj1dIUpZQQm/D pMz2CVpVNUNcfKTKAjLOgOjG1EtM+IDB7mjuCC89ctf3UAYA04B+62+j/D4nWBX4u3RB 66ZVkJzsmqp0u1lgFKRq01fUOpbcO9UuHjEPISy6BbQ8jyvsbaiFIvYCiRdVuIS+uZ+H e0OQ== X-Gm-Message-State: AOAM530DffcoYNO9L5k5RPtuh6cyLnGruprsgtkF+HhH0Yyjyd4VdtUM kdQLqJUod5mh828AGxv1Eg6RqFeWI94= X-Google-Smtp-Source: ABdhPJxG5WDG/1t+TPzHsMAP46ZGMRgVFNGq/hijDSmnIFmA6vazWPo//rW6lEM43mborFGV0Uf5+w== X-Received: by 2002:adf:ec4e:: with SMTP id w14mr7190451wrn.280.1594744981448; Tue, 14 Jul 2020 09:43:01 -0700 (PDT) Received: from localhost.localdomain (138.red-83-57-170.dynamicip.rima-tde.net. [83.57.170.138]) by smtp.gmail.com with ESMTPSA id 138sm6474380wmb.1.2020.07.14.09.43.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jul 2020 09:43:00 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH-for-5.1 2/4] qemu/osdep: Reword qemu_get_exec_dir() documentation Date: Tue, 14 Jul 2020 18:42:55 +0200 Message-Id: <20200714164257.23330-3-f4bug@amsat.org> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200714164257.23330-1-f4bug@amsat.org> References: <20200714164257.23330-1-f4bug@amsat.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::431; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-x431.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: 0 X-Spam_score: 0.0 X-Spam_bar: / X-Spam_report: (0.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=1, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Sarah Harris , Stefan Weil , =?utf-8?q?Phil?= =?utf-8?q?ippe_Mathieu-Daud=C3=A9?= , Michael Rolnik , Paolo Bonzini Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" This comment is confuse, reword it a bit. Signed-off-by: Philippe Mathieu-Daudé --- include/qemu/osdep.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index 979a403984..a96849dd90 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -588,7 +588,10 @@ char *qemu_get_local_state_pathname(const char *relative_pathname); void qemu_init_exec_dir(const char *argv0); /* Get the saved exec dir. - * Caller needs to release the returned string by g_free() */ + * + * The caller is responsible for releasing the value returned with g_free() + * after use. + */ char *qemu_get_exec_dir(void); /** From patchwork Tue Jul 14 16:42:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 277872 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 49BE8C433E5 for ; Tue, 14 Jul 2020 16:49:28 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 146E32256C for ; Tue, 14 Jul 2020 16:49:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="QGJZEMV0" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 146E32256C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:39946 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jvO7T-0001k2-AJ for qemu-devel@archiver.kernel.org; Tue, 14 Jul 2020 12:49:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44156) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jvO1J-00015P-KE for qemu-devel@nongnu.org; Tue, 14 Jul 2020 12:43:05 -0400 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]:55634) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jvO1H-0006oV-Um for qemu-devel@nongnu.org; Tue, 14 Jul 2020 12:43:05 -0400 Received: by mail-wm1-x343.google.com with SMTP id g75so6829999wme.5 for ; Tue, 14 Jul 2020 09:43:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2uqdg4rXwANaV6cVAKV4VhRMp7hv8Go60MYRFCgr3o4=; b=QGJZEMV0YV2oXUv6AOx4MA+YoAz9S/1wYuFkTAGPpUCFX6QclRLySp5SWpHgwZpXd2 xF8btEkBO1jZVUIeVZnRfxt3eqBLefWxVJNhU8glncms+0ccUmPGpUtDb1Ek7QQbFKaY UXik62yCKDryq9XU2t/gpjLWFG0BRQTT155Oq7XlMpaLJz5SFLdGQ/xZFgkRKN+4/CP3 eKdVzjvp7TiSBrSbEuf9SgTWrk8UjfyPGhHgEtf+QafFn7X49P8CpyKtwPomwnQFs5dP O0Ek3Cj12zC6+ILbqymS3U0727lVe5SfqMUIL3muczZOuXZqgzMfVOv/rw8nGGI/RwDL GFZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=2uqdg4rXwANaV6cVAKV4VhRMp7hv8Go60MYRFCgr3o4=; b=ZBqawr1gR3aOZZoM/7MwtrPTWNlDG+/Gu36xryotz70gAbE/YeGa9b6U37r4D0lfrU JNyHQ0o9Eq+nVykoZtSxCp+HLr0vfqICZH/kXtAUAsXFrN4QyOJMXXi58mDwCy94+8Wn O4IgwZTcMVk85+TDJPBSZgHNo/CbT8GmRWZf4AETe1e3ujm/fw56iWDubIwuzuNc4nae Tlp8xsuOVoeowLxv2Ah2j5xZINuoOCov5v1jaewdbPUvN+ngg3e1zjNKaTPzWmylwe5w Ds4yeDI4glZrnp7VKBHuIkJONAIv/wkZTxUqRpccy7jlG7fmdqPb4g/AnfYCxsyZcGYt /xXQ== X-Gm-Message-State: AOAM533ltvuqO2XE2/MBBVSJVwXEDuKbS40ln2edalfXtNnGIJU3t6uZ nnW+jgBR1zJbSd/5u2cCzDzyu4fwEzo= X-Google-Smtp-Source: ABdhPJw3DS0HT+Zm8c31wbeXSUY9nKbcAYcwTpVE4nYMPjhfBuVdSk3qHKXXzqcoIl84MD97tl4TWg== X-Received: by 2002:a05:600c:2285:: with SMTP id 5mr4982825wmf.78.1594744982459; Tue, 14 Jul 2020 09:43:02 -0700 (PDT) Received: from localhost.localdomain (138.red-83-57-170.dynamicip.rima-tde.net. [83.57.170.138]) by smtp.gmail.com with ESMTPSA id 138sm6474380wmb.1.2020.07.14.09.43.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jul 2020 09:43:01 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH-for-5.1 3/4] qemu-common: Document qemu_find_file() Date: Tue, 14 Jul 2020 18:42:56 +0200 Message-Id: <20200714164257.23330-4-f4bug@amsat.org> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200714164257.23330-1-f4bug@amsat.org> References: <20200714164257.23330-1-f4bug@amsat.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::343; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-x343.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: 0 X-Spam_score: 0.0 X-Spam_bar: / X-Spam_report: (0.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=1, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Sarah Harris , Stefan Weil , =?utf-8?q?Phil?= =?utf-8?q?ippe_Mathieu-Daud=C3=A9?= , Michael Rolnik , Paolo Bonzini Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Document qemu_find_file(), in particular the returned value which must be freed. Signed-off-by: Philippe Mathieu-Daudé --- include/qemu-common.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/include/qemu-common.h b/include/qemu-common.h index d0142f29ac..d6a08259d3 100644 --- a/include/qemu-common.h +++ b/include/qemu-common.h @@ -110,6 +110,20 @@ const char *qemu_get_vm_name(void); #define QEMU_FILE_TYPE_BIOS 0 #define QEMU_FILE_TYPE_KEYMAP 1 +/** + * qemu_find_file: + * @type: QEMU_FILE_TYPE_BIOS (for BIOS, VGA BIOS) + * or QEMU_FILE_TYPE_KEYMAP (for keymaps). + * @name: File name + * + * Search for @name file in the data directories, either configured at + * build time (DATADIR) or registered with the -L command line option. + * + * The caller must use g_free() to free the returned data when it is + * no longer required. + * + * Returns: absolute path to the file or NULL on error. + */ char *qemu_find_file(int type, const char *name); /* OS specific functions */ From patchwork Tue Jul 14 16:42:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 277873 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 82C42C433E3 for ; Tue, 14 Jul 2020 16:46:19 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 507E02242C for ; Tue, 14 Jul 2020 16:46:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="D6JeR7ni" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 507E02242C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=amsat.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:58344 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jvO4Q-0005zi-JX for qemu-devel@archiver.kernel.org; Tue, 14 Jul 2020 12:46:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44160) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jvO1K-00016k-8R for qemu-devel@nongnu.org; Tue, 14 Jul 2020 12:43:06 -0400 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]:35708) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jvO1I-0006og-RM for qemu-devel@nongnu.org; Tue, 14 Jul 2020 12:43:05 -0400 Received: by mail-wr1-x444.google.com with SMTP id z2so23010981wrp.2 for ; Tue, 14 Jul 2020 09:43:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=PzbjB/znNTLdn/duWFeKb6OtNfTdbAMU2eEEnU94nEU=; b=D6JeR7niBPeOtM2aVpDV7H5eGxh1Ga04hpsRY8rq57U+JAW8Bp+9pCT9Z6bKlknHYS VqJ3kjWCz/BZbnRqOQgqsaFc5IBCtQ5SqdQKqzr4l/mO0oTgspErlnajjDq0VhBBZDoR l7y6tMrUzkXB06v8RA6roiUxfOT7+0s4bMo/5GhR/BgCj57LIEG+8qI6K3nEqwfd28Ma D34hucEA/nquLozEj1L3GvZG3yuvivDeSforMu0fFrVdaeFgHCFbE1R4neGBsKp1qClv CibaC8jeqw7B2n8Tczy6WTx1nrwQxXEvHRNMI+vajkSREgSq/HGheQ/Mo26h5l4ifOSw CpzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=PzbjB/znNTLdn/duWFeKb6OtNfTdbAMU2eEEnU94nEU=; b=IkLEOev+5EWTFTWV1lZF0ZOg3PJ2xpMESZ76bxnmPfqR4cBPlCrgTp2nxmL1PG+lWv HyYkG8aYm866zQa20yPcYtqpTXPNkoemWA+ZC2NN6S7knq4xOB05ot5CNXmB6On8m5w4 r8zSmG8EUUYoEYxHCtxJHJXECFPJyaePIC+lHO7xe9FQ2KLPKuXcj5y1Y8ntYs67BJL4 QJ2xlhJivCAdtbHU19v3FIDI3Hx6mw8OCD9yeH/vQ7y9QZ9ty1l+77o8fvkESmjrzebP NaYjvDVmC6CAz81jzQCURXLDQPu6qrzhv5v6LF+tdIVNC36XlXTpqkSXp/6JQrdFH0nq Eh9g== X-Gm-Message-State: AOAM530D0Il5xhcqj/4TVB/UCLg02ttmDzuWEvJKMl6dzMl4RI44UzRv S1iLu+PJLkCfAKsh9MLU1uy7gVKcHsw= X-Google-Smtp-Source: ABdhPJznc143xysamN84kM58D8aC4AFCINXWkIKeiF9kYtcARHnZQith5zcV9pZyfF1TmEKG9HMXhQ== X-Received: by 2002:adf:f60b:: with SMTP id t11mr7324748wrp.249.1594744983428; Tue, 14 Jul 2020 09:43:03 -0700 (PDT) Received: from localhost.localdomain (138.red-83-57-170.dynamicip.rima-tde.net. [83.57.170.138]) by smtp.gmail.com with ESMTPSA id 138sm6474380wmb.1.2020.07.14.09.43.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jul 2020 09:43:02 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH-for-5.1 4/4] hw/avr/boot: Fix memory leak in avr_load_firmware() Date: Tue, 14 Jul 2020 18:42:57 +0200 Message-Id: <20200714164257.23330-5-f4bug@amsat.org> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200714164257.23330-1-f4bug@amsat.org> References: <20200714164257.23330-1-f4bug@amsat.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::444; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-x444.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: 0 X-Spam_score: 0.0 X-Spam_bar: / X-Spam_report: (0.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=1, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Sarah Harris , Stefan Weil , =?utf-8?q?Phil?= =?utf-8?q?ippe_Mathieu-Daud=C3=A9?= , Michael Rolnik , Paolo Bonzini Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" The value returned by qemu_find_file() must be freed. This fixes Coverity issue CID 1430449, which points out that the memory returned by qemu_find_file() is leaked. Fixes: Coverity CID 1430449 (RESOURCE_LEAK) Fixes: 7dd8f6fde4 ('hw/avr: Add support for loading ELF/raw binaries') Signed-off-by: Philippe Mathieu-Daudé --- hw/avr/boot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/avr/boot.c b/hw/avr/boot.c index 6fbcde4061..151734f82d 100644 --- a/hw/avr/boot.c +++ b/hw/avr/boot.c @@ -60,7 +60,7 @@ static const char *avr_elf_e_flags_to_cpu_type(uint32_t flags) bool avr_load_firmware(AVRCPU *cpu, MachineState *ms, MemoryRegion *program_mr, const char *firmware) { - const char *filename; + g_autofree char *filename; int bytes_loaded; uint64_t entry; uint32_t e_flags;