From nobody Mon Feb 9 17:07:54 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1538653265773260.89268829362743; Thu, 4 Oct 2018 04:41:05 -0700 (PDT) Received: from localhost ([::1]:55147 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g8208-0001ic-Fg for importer@patchew.org; Thu, 04 Oct 2018 07:41:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34639) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g81st-000411-H4 for qemu-devel@nongnu.org; Thu, 04 Oct 2018 07:33:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g81iO-0003Sw-5m for qemu-devel@nongnu.org; Thu, 04 Oct 2018 07:22:48 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:39952) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1g81iN-0003Sl-VE for qemu-devel@nongnu.org; Thu, 04 Oct 2018 07:22:44 -0400 Received: by mail-wr1-f67.google.com with SMTP id d2-v6so5058522wro.7 for ; Thu, 04 Oct 2018 04:22:43 -0700 (PDT) Received: from fiorina.brq.redhat.com (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id k7-v6sm5191789wmf.41.2018.10.04.04.22.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Oct 2018 04:22:41 -0700 (PDT) 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=9TgnOkRe56uCIfYJy4HqUUQRlSYhp0EwqdJ05l2ODI4=; b=nGmBKypQQ8vETlXcauvo22VemB1cPOOhD43qvbEHuaw+N40fITzTLxlB49eFI9oiAe vIxo2ekL90kBizVyaqbRmMh2EepXokYIrJCSzPtOe5VL2cJfMh1LOGGNIPh/pz2M8/eG 8udO1Rtxv7t8waWX2af5bBEcobDow2Y2G0BAShLk6p3FOJUr+ug3Ss9MaM665c5h2uk9 kK/AdSULcJoH5nLnSRztJXn/oqyoGydLLRAeCfAqw9rXV1F3R0ecgJDXT+Icj+nvm562 wA60E4vwYKaAyC5teEk4vXqHK4Mv7NblYhyZAKWggkLPwlPEwhL/NfbrnRXBxwD7GITO 56SA== X-Gm-Message-State: ABuFfognVqiY6QujiKfyGKC6dEzK/xCeRlphWUzrcdiIGAg/gLdl3KYm CwcqdeK6visVh8D1QzOMD64SDf0tuWM= X-Google-Smtp-Source: ACcGV60/jkL3A9rJrT3J1ZAkaQ0Yv6jHXvNAPZ2/9rYQVtXdNx/TL1dOqiWn2LTrLzCbYUiXu7dPnw== X-Received: by 2002:adf:f90b:: with SMTP id b11-v6mr4530667wrr.307.1538652162569; Thu, 04 Oct 2018 04:22:42 -0700 (PDT) From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Golembiovsk=C3=BD?= To: qemu-devel@nongnu.org Date: Thu, 4 Oct 2018 13:22:29 +0200 Message-Id: X-Mailer: git-send-email 2.19.0 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.221.67 Subject: [Qemu-devel] [PATCH v4 02/11] qga-win: handle NULL values X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michael Roth , Olga Krishtal , =?UTF-8?q?Tom=C3=A1=C5=A1=20Golembiovsk=C3=BD?= , Sameeh Jubran , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Handle returned NULLs properly to: - avoid crashes in serialization. - properly report errors to the caller Signed-off-by: Tom=C3=A1=C5=A1 Golembiovsk=C3=BD --- qga/commands-win32.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/qga/commands-win32.c b/qga/commands-win32.c index 9c959122d9..49fc747298 100644 --- a/qga/commands-win32.c +++ b/qga/commands-win32.c @@ -735,6 +735,12 @@ static GuestFilesystemInfo *build_guest_fsinfo(char *g= uid, Error **errp) } fs->type =3D g_strdup(fs_name); fs->disk =3D build_guest_disk_info(guid, errp); + if (fs->disk =3D=3D NULL) { + g_free(fs); + fs =3D NULL; + goto free; + } + free: g_free(mnt_point); return fs; @@ -755,7 +761,7 @@ GuestFilesystemInfoList *qmp_guest_get_fsinfo(Error **e= rrp) do { GuestFilesystemInfo *info =3D build_guest_fsinfo(guid, errp); if (info =3D=3D NULL) { - continue; + goto out; } new =3D g_malloc(sizeof(*ret)); new->value =3D info; @@ -767,6 +773,7 @@ GuestFilesystemInfoList *qmp_guest_get_fsinfo(Error **e= rrp) error_setg_win32(errp, GetLastError(), "failed to find next volume= "); } =20 +out: FindVolumeClose(vol_h); return ret; } --=20 2.19.0