From patchwork Tue Jul 21 18:01:34 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: 277648 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 644A0C433E4 for ; Tue, 21 Jul 2020 18:03:13 +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 30F6520717 for ; Tue, 21 Jul 2020 18:03:13 +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="N3ShT0T3" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 30F6520717 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]:45232 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jxwbg-0002BW-EF for qemu-devel@archiver.kernel.org; Tue, 21 Jul 2020 14:03:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37380) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jxwaG-0000Ye-Bp for qemu-devel@nongnu.org; Tue, 21 Jul 2020 14:01:44 -0400 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:44055) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jxwaE-0003uU-3v for qemu-devel@nongnu.org; Tue, 21 Jul 2020 14:01:44 -0400 Received: by mail-wr1-x442.google.com with SMTP id b6so22049378wrs.11 for ; Tue, 21 Jul 2020 11:01:41 -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=nGbAj6ZH6l89XvGft/14MftdLsK17sbLjcwJZB02Jko=; b=N3ShT0T37HLVJc1Xdac6puxQ96VnF5eAL36yhz3QwMY6muqZ2JMcXjhbcC1e7c92XX LfMyMiLrPk6mHE4y0JzkNX3vo8R86x1V4jES/byfUpA6ffEqJijnXHgS70wY1nOrf+ha L4Ly6+vrpKQiTJFfCmJeBz24Fw4fSsd/Mq9+NssEsdmDItrzByEPzo7p8UkQLGljZrQv /JL6xy5QfDujr1GG6lfOO9qLrztejIVQEu311evjN/2JTy4wrHaJaMQtffoJRjhtgaWk KjCzxlYoKjzIU462f2j9MSEnHNLLE6SaJjWqSolUI5OyAFQM+1kwrL2nCDIoyF5VfzWx EBtQ== 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=nGbAj6ZH6l89XvGft/14MftdLsK17sbLjcwJZB02Jko=; b=C64vg3p++kGSyGE1iwmyuCKG8kZTo9SogNfE33341xQE91r12e3Mao93xy8QINnHK1 cBI5NlT8nVvZv7EmovLR+800LqEk0hg91tzacBU1HATSICS9TNYv6y17BB/+weA+UkMy WZU7o2lMXLwx3jMlsgFPafqM6bv3YfKHyuOqSeL4LRIrkDbqEprrAKjrBJYcWIGYKPXX USUWqQtSomFtCjnvLySglvjzpSOWuvAX2DEV91Fyl2778P4rLgpw+ODlG2nH2qQ/CHDN dKhyCCZQwFphhEUi2WmYtyDxY3Rt+FjXrcyfAs6Y15eG9L8JEHOmmXI19Mmk0+fCuoDg ZH1Q== X-Gm-Message-State: AOAM533lRNcnMsq3dM7OAyqLR0AAkdzTyOtuZ6egSOvtRtdI8lS7tsJz tQQbFNd/mumBY8E4c9DQXglOyZmLdKU= X-Google-Smtp-Source: ABdhPJyELdELKH3uS2biIJU1tQW79RVDGA9j1e3h5T6enYWhc3T7M6OqH/Rp90e1tgOlGnyhXZ0JSg== X-Received: by 2002:adf:9463:: with SMTP id 90mr7337931wrq.223.1595354500319; Tue, 21 Jul 2020 11:01:40 -0700 (PDT) Received: from x1w.redhat.com (138.red-83-57-170.dynamicip.rima-tde.net. [83.57.170.138]) by smtp.gmail.com with ESMTPSA id t2sm3557249wmb.25.2020.07.21.11.01.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jul 2020 11:01:39 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 1/4] qemu/osdep: Document os_find_datadir() return value Date: Tue, 21 Jul 2020 20:01:34 +0200 Message-Id: <20200721180137.11136-2-f4bug@amsat.org> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200721180137.11136-1-f4bug@amsat.org> References: <20200721180137.11136-1-f4bug@amsat.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::442; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-x442.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: Sarah Harris , =?utf-8?q?Daniel_P_=2E_Berrang?= =?utf-8?b?w6k=?= , Stefan Weil , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Michael Rolnik , Paolo Bonzini Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Document os_find_datadir() returned data must be freed. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Michael Rolnik Tested-by: Michael Rolnik Reviewed-by: Daniel P. Berrangé Message-Id: <20200714164257.23330-2-f4bug@amsat.org> --- os-posix.c | 3 +++ os-win32.c | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/os-posix.c b/os-posix.c index b674b20b1b..3572db3f44 100644 --- a/os-posix.c +++ b/os-posix.c @@ -84,6 +84,9 @@ void os_setup_signal_handling(void) * Find a likely location for support files using the location of the binary. * When running from the build tree this will be "$bindir/../pc-bios". * Otherwise, this is CONFIG_QEMU_DATADIR. + * + * The caller must use g_free() to free the returned data when it is + * no longer required. */ char *os_find_datadir(void) { diff --git a/os-win32.c b/os-win32.c index 6b86e022f0..c9c3afe648 100644 --- a/os-win32.c +++ b/os-win32.c @@ -57,7 +57,12 @@ void os_setup_early_signal_handling(void) atexit(os_undo_timer_resolution); } -/* Look for support files in the same directory as the executable. */ +/* + * Look for support files in the same directory as the executable. + * + * The caller must use g_free() to free the returned data when it is + * no longer required. + */ char *os_find_datadir(void) { return qemu_get_exec_dir(); From patchwork Tue Jul 21 18:01:36 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: 277647 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 0CE61C433E3 for ; Tue, 21 Jul 2020 18:03:14 +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 CF04A20720 for ; Tue, 21 Jul 2020 18:03:13 +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="HPSpeOeu" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CF04A20720 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]:45300 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jxwbh-0002DE-2l for qemu-devel@archiver.kernel.org; Tue, 21 Jul 2020 14:03:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37448) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jxwaI-0000ax-GC for qemu-devel@nongnu.org; Tue, 21 Jul 2020 14:01:46 -0400 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]:37305) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jxwaG-0003ut-RK for qemu-devel@nongnu.org; Tue, 21 Jul 2020 14:01:46 -0400 Received: by mail-wr1-x42d.google.com with SMTP id y3so4714591wrl.4 for ; Tue, 21 Jul 2020 11:01:44 -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=qgnMWdA6GNo7AWlQMpq/zRkLjbt1h9TvjUdYX6CVScw=; b=HPSpeOeu3CjvdDLSOuXfMdGwH300aFkQ4O4JLvYu3bm3amBQTVDyzCBoYT7WECskPA bv+RnLbtUoJKfFocGHyNGQM6AyPN7jXVf7VqmhmqK6LL8AiMicnno5ufQgu4yNxYoC4D DsHjAO9WEXoFUTjOml4o5nG0R4k0T3gJk1lgiKTkast5ALUqsJcwapAGjMLnl5bNHcso +cjXxV4V9W6y09F04mg/Re639awSGFxAB40d1S/PuO2lCN+kFxYnjh+V3QmRqtBjuY/3 SsJD0gTSZ3KbBzNKs7FqdoZa5S3z2qGemSsLT4O5afaq/RRSwDCiivaM8xIWjrro4a1j Wx8Q== 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=qgnMWdA6GNo7AWlQMpq/zRkLjbt1h9TvjUdYX6CVScw=; b=Lnr8c0i+cYHLa3eI6pvIPU5Xrd4246UGGdbWrrilL7mdNJSY5i4JxUavr1itZig0AF rifyEoVr7Dvr/5hAHKPABK872z3UG26mvaqVJ3oShtOEMEIRkeoIdB473wcgOUWymtCv PqVv09kowUkHpzqxCVTFdxXjMz/p+R9i5fviACgu/IgKqOhvFw5mlcUY2F7I+71T14Gf Bk4nTnEf4TwVNj3pt1YJNoN2NjxS6mKquu8jAqTVBIbXF87SsDObuhIfxfWtTBxDeK64 BSFIMd+lhYpoYrNiySuPMXVKHcjG2BxW95r9HTtkctTk56KATXL1Q8VJd+ZDg72v/OD4 RD0w== X-Gm-Message-State: AOAM531/sKbM5Y+jNfLwwFUlPk6+YhB+YfdjhExY2PUgDV0iiLE1uzmg cBOH2eyWd53Spy4nqs3PPtkyg/F2oG8= X-Google-Smtp-Source: ABdhPJyjOHL7RbdyGU3qt9khevryKoH6p22/ZHcAiiAvd3lWqhaCpbNMnO8Tql9iGUbqrV/4L7bI6g== X-Received: by 2002:adf:ab46:: with SMTP id r6mr27867714wrc.260.1595354502628; Tue, 21 Jul 2020 11:01:42 -0700 (PDT) Received: from x1w.redhat.com (138.red-83-57-170.dynamicip.rima-tde.net. [83.57.170.138]) by smtp.gmail.com with ESMTPSA id t2sm3557249wmb.25.2020.07.21.11.01.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jul 2020 11:01:42 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 3/4] qemu-common: Document qemu_find_file() Date: Tue, 21 Jul 2020 20:01:36 +0200 Message-Id: <20200721180137.11136-4-f4bug@amsat.org> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200721180137.11136-1-f4bug@amsat.org> References: <20200721180137.11136-1-f4bug@amsat.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-x42d.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 , =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= , Stefan Weil , Li Qiang , =?utf-8?q?Philippe_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é Reviewed-by: Peter Maydell Reviewed-by: Li Qiang Reviewed-by: Michael Rolnik Tested-by: Michael Rolnik Reviewed-by: Daniel P. Berrangé Message-Id: <20200714164257.23330-4-f4bug@amsat.org> --- include/qemu-common.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/include/qemu-common.h b/include/qemu-common.h index d0142f29ac..bb9496bd80 100644 --- a/include/qemu-common.h +++ b/include/qemu-common.h @@ -110,6 +110,23 @@ 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: Relative or absolute file name + * + * If @name exists on disk as an absolute path, or a path relative + * to the current directory, then returns @name unchanged. + * Otherwise searches 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: a path that can access @name, or NULL if no matching file exists. + */ char *qemu_find_file(int type, const char *name); /* OS specific functions */ From patchwork Tue Jul 21 18:01:37 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: 277646 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 5BE2EC433DF for ; Tue, 21 Jul 2020 18:06:07 +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 26938206F5 for ; Tue, 21 Jul 2020 18:06:07 +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="sZYwBps8" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 26938206F5 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]:51690 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jxweU-0004zy-98 for qemu-devel@archiver.kernel.org; Tue, 21 Jul 2020 14:06:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37472) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jxwaJ-0000c0-5P for qemu-devel@nongnu.org; Tue, 21 Jul 2020 14:01:47 -0400 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:40627) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jxwaH-0003v9-B7 for qemu-devel@nongnu.org; Tue, 21 Jul 2020 14:01:46 -0400 Received: by mail-wr1-x442.google.com with SMTP id f2so22034777wrp.7 for ; Tue, 21 Jul 2020 11:01:44 -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=zEMRo8te83NUGt40sJx+NazqtYzYQf05FrJyvrG948Y=; b=sZYwBps8b/LtZWO8+sYkq3qR+HOurIu0jtzqKe6XEt56EkVxZrq8JoECbVH+paNR74 gf7TbW/kdfM9a//8imSkAjQS0y0HRZoScBVVbwjAg0xFgjOUabpoQpEqkp9tBQ9n7esG jm2q/BGQSuJ6sHyy7DPdZds7J7hukykgFzQdW8vsvvzCD14kWlTUeyv6AqfnE2rdu/dK 4c1q7tkvIX11/EQeLSAHgggNKrgfG9ANi++m5bd5ucHHV9p7gOxizo/rzOyoCAjCfNk4 RX5/oyoT6mHWFbj+rPxgHWoT4+uva0/8PYyW1vU13lApR4qGDPvE/VOEOfXPIR2ASz1Q 65aA== 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=zEMRo8te83NUGt40sJx+NazqtYzYQf05FrJyvrG948Y=; b=eIfDFWw9lJcLlfU3EQV+7A0FfvNZd2hTPWFPphn0iaq8W4zV+kzUzeW1RxrYQ4UBMr HPTxJcvJ2bYDYW+XJzHL8EW0VpckVTVwn12gzFUKYk+s6Am9qL5ysy1ddmLSqB6CqrsO 0rMqDkpD7/E3JMYtWs54buXp+m7dSTDFfitjddsLZS2YaLEAXHis8XcoHi/OsXdnyAB5 1794GXUGn6EHQJkvUj1fHz080mhw+M5BN9Bte+D+txA9YuKovW8ARRh9wyL9z4sRwjtg VxctuDazCcGu1Oz+7XtU9/e+IS0zV6+IJeajoMf8fWydwmV4pY7R6GjVq0HktFS+pgOg prDw== X-Gm-Message-State: AOAM531OIbQyKI3cI3cgOhRG7Fb7wH4ccKIZlYbxm7pOK8J/JWs5w7qb mPfa3Noo9UiHgVGR+0EXg00JSuvzCf4= X-Google-Smtp-Source: ABdhPJxbXlMNujAC2hiHXEpPhXMssKW3WtBTjgzjbKnkot3uHqqs9XBDE8dzjr7TbtAs6XY6SBO9eQ== X-Received: by 2002:adf:a3d0:: with SMTP id m16mr26289978wrb.232.1595354503725; Tue, 21 Jul 2020 11:01:43 -0700 (PDT) Received: from x1w.redhat.com (138.red-83-57-170.dynamicip.rima-tde.net. [83.57.170.138]) by smtp.gmail.com with ESMTPSA id t2sm3557249wmb.25.2020.07.21.11.01.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jul 2020 11:01:43 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 4/4] hw/avr/boot: Fix memory leak in avr_load_firmware() Date: Tue, 21 Jul 2020 20:01:37 +0200 Message-Id: <20200721180137.11136-5-f4bug@amsat.org> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200721180137.11136-1-f4bug@amsat.org> References: <20200721180137.11136-1-f4bug@amsat.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::442; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-x442.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: Sarah Harris , =?utf-8?q?Daniel_P_=2E_Berrang?= =?utf-8?b?w6k=?= , Stefan Weil , =?utf-8?q?Philippe_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é Reviewed-by: Michael Rolnik Tested-by: Michael Rolnik Reviewed-by: Daniel P. Berrangé Message-Id: <20200714164257.23330-5-f4bug@amsat.org> --- 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..d16bb3dbe1 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 = NULL; int bytes_loaded; uint64_t entry; uint32_t e_flags;