From patchwork Fri Nov 15 13:10:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 179495 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp12433064ilf; Fri, 15 Nov 2019 05:11:53 -0800 (PST) X-Google-Smtp-Source: APXvYqzbDZYbBCdOXulGW/ca7dFZvme8b+65qTWNUVf9NgqYF5hHUPL3bzAwbQbt1tJmS3tIYsts X-Received: by 2002:a0c:8c0e:: with SMTP id n14mr9790845qvb.179.1573823513397; Fri, 15 Nov 2019 05:11:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573823513; cv=none; d=google.com; s=arc-20160816; b=McreSwv9Ll02ZbfcBepQXRx4Ot3/Kyc6SYWrNov+TwF8p8m04hlEIHn90/lXF7019C aGvZyoWJMdny+L6Rh1bFXFD+RoPuUfXRiTFsLi/mYXm6Pfudo6jTh7aCrH2CL8RB8x0t BI1e3PkZsm+uAMbgRwu7XcK2h0CM4Le7MILNOTCkvUxFkmGvUrQaUibbRIJ+xDx+9axn /yXKwg0UKdx/cDqyqOlAxbBXumspGRXQ3JpjZuSYDAqyzN8wmapWGKfiB/Ecu9TEendS uc0QRUXfErJPtB6Sqs/Kjs/+Rxr6Tsf4fznpY9cV/5M1LOnyzH6gJp78/6e00cAcKG5w Ykpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=diXnF1IPkkxinXlGIqTBKK6HjgFjUcsfRfseHjAG8V0=; b=ptbDGFr8ccH178BuWweoKhY8XuuZRny553Zo4H+raGTaRxByx8SvfNtY4Oq31mPzmV 9jfofpdQvLLpdJf6KUAmiofvLd6p4zYHMNg1wtrPLfZWjJWD0OiTDPAQ8JiQXlTMSafs 1BF73LdCGoD0P7iIHfnyVe4IgrTjE8u2xEfwRmNqzleRy7fqTiPCkgLEbutbF/Usb9Fg SPENYDSoUfmdmE07lJE9Y19L/ZuVUlg1YFdC3waZr/y01vk9lQhRsColZa50PGNJU13d 4B9ZjNGEiISP9kTBuO03j7ddiUPx62YMBtxG5Iok5ADVg/2g/iz5AKXYCLT0cbxER3ae pgRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=cd6e2128; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id o22si5467142qvh.30.2019.11.15.05.11.53 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 15 Nov 2019 05:11:53 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=cd6e2128; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:39030 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iVbOC-0004Q4-J9 for patch@linaro.org; Fri, 15 Nov 2019 08:11:52 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49403) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iVbNw-0004Ns-9m for qemu-devel@nongnu.org; Fri, 15 Nov 2019 08:11:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iVbNv-0004O9-CL for qemu-devel@nongnu.org; Fri, 15 Nov 2019 08:11:36 -0500 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]:36676) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iVbNv-0004Nu-7N for qemu-devel@nongnu.org; Fri, 15 Nov 2019 08:11:35 -0500 Received: by mail-pf1-x444.google.com with SMTP id b19so6673833pfd.3 for ; Fri, 15 Nov 2019 05:11:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=diXnF1IPkkxinXlGIqTBKK6HjgFjUcsfRfseHjAG8V0=; b=cd6e2128QvkQXDsV9YD8foQDT+InMB8+/EC8yNh5eodUOIOk46ov2fxlrC+Rga724A 0eMaAEnLcc18PQIqTYUj8DLuT3btXEuJHiFbHurp/AV4jQfzlOKNRtg8i0YNbGewu8Ne SGk4KzfftSfi19UBpr1BV17IZsj7/U1d89Ua400q+aY4kVO5DAvConKmWLgQN+BZEnxS jpsYNtbfC0lymsaj2ku5k9nozilZLoiQMsivwAPpvFHvo684hOr8UW4bte5mN/VbR8Hr bbElEXLyo+edAk0n7m71zOM7dt/ilwtKT+vMH1gGtSBi+qUDDmnqb38ZvxCpVxYMQQw8 2VeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=diXnF1IPkkxinXlGIqTBKK6HjgFjUcsfRfseHjAG8V0=; b=MWXHgV8y1c9yF1NnFf5zm3cUBpzX934xKpyCI/zxgNJi5imlZkZRkrRh0IyInSxoCy BJyuNNCgj5LwT2giGeZLicLYgQr+vExa+6rJvH34X+r4nXOV02fjeYWLmDPyIG4YqQtf HIkrR9VXlonAPnEWguJXBIiCJGlYp1ddTe+GG0G3esJAYx/aPQy/sItrTeBJJuRh0z/5 F7i44vwJrflwS4oWdOoF4b5CR9lfzjR1xLwVj8zM1nkusaTFhoOMPoMcOfO7GtxO6lS8 q8WGlodHCqtOMQcrDkEmbSpPoGa9HHHeNxgHz0+Gu94SiIIuqpsDr2w4WfI+Bl3qfBEl wQdA== X-Gm-Message-State: APjAAAVQKPfn6UVJBg7O8oda7bsWmzcLA5xh3U2Gg5pxYWx4u0Zz7Lju cTrDEIAQYZE4PON36mOqdvxtYO8NIS0= X-Received: by 2002:a63:201b:: with SMTP id g27mr14642133pgg.56.1573823493901; Fri, 15 Nov 2019 05:11:33 -0800 (PST) Received: from Rfoley-MA01.usrd.futurewei.com ([12.111.81.71]) by smtp.gmail.com with ESMTPSA id w138sm12007249pfc.68.2019.11.15.05.11.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Nov 2019 05:11:33 -0800 (PST) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v2 1/6] Fix double free issue in qemu_set_log_filename(). Date: Fri, 15 Nov 2019 08:10:35 -0500 Message-Id: <20191115131040.2834-2-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191115131040.2834-1-robert.foley@linaro.org> References: <20191115131040.2834-1-robert.foley@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::444 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.puhov@linaro.org, alex.bennee@linaro.org, robert.foley@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" After freeing the logfilename, we set logfilename to NULL, in case of an error which returns without setting logfilename. Signed-off-by: Robert Foley Reviewed-by: Alex Bennée --- v2 - moved this change to the beginning of the patch series. --- v1 - This is new in the patch v1. --- util/log.c | 1 + 1 file changed, 1 insertion(+) -- 2.17.1 diff --git a/util/log.c b/util/log.c index 1ca13059ee..4316fe74ee 100644 --- a/util/log.c +++ b/util/log.c @@ -113,6 +113,7 @@ void qemu_set_log_filename(const char *filename, Error **errp) { char *pidstr; g_free(logfilename); + logfilename = NULL; pidstr = strstr(filename, "%"); if (pidstr) {