summary refs log tree commit diff stats
path: root/qga/commands-posix.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2020-04-05 18:28:17 +0100
committerPeter Maydell <peter.maydell@linaro.org>2020-04-05 18:28:17 +0100
commit547522cd3d2b006d249457f4c06bd82c8c247d1f (patch)
tree760bc12e74b1c1efb0c829c6f24a6a1b232b7dd0 /qga/commands-posix.c
parent146aa0f104bb3bf88e43c4082a0bfc4bbda4fbd8 (diff)
parent6a4a38530e70f3917a58d71d4d08e28bd8146015 (diff)
downloadfocaccia-qemu-547522cd3d2b006d249457f4c06bd82c8c247d1f.tar.gz
focaccia-qemu-547522cd3d2b006d249457f4c06bd82c8c247d1f.zip
Merge remote-tracking branch 'remotes/armbru/tags/pull-error-2020-04-04' into staging
Error reporting patches for 2020-04-04

# gpg: Signature made Sat 04 Apr 2020 13:19:40 BST
# gpg:                using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653
# gpg:                issuer "armbru@redhat.com"
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" [full]
# gpg:                 aka "Markus Armbruster <armbru@pond.sub.org>" [full]
# Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867  4E5F 3870 B400 EB91 8653

* remotes/armbru/tags/pull-error-2020-04-04:
  qga/commands-posix: fix use after free of local_err
  dump/win_dump: fix use after free of err
  scripts/coccinelle: add error-use-after-free.cocci

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'qga/commands-posix.c')
-rw-r--r--qga/commands-posix.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/qga/commands-posix.c b/qga/commands-posix.c
index 93474ff770..cc69b82704 100644
--- a/qga/commands-posix.c
+++ b/qga/commands-posix.c
@@ -1773,6 +1773,7 @@ static void guest_suspend(SuspendMode mode, Error **errp)
     }
 
     error_free(local_err);
+    local_err = NULL;
 
     if (pmutils_supports_mode(mode, &local_err)) {
         mode_supported = true;
@@ -1784,6 +1785,7 @@ static void guest_suspend(SuspendMode mode, Error **errp)
     }
 
     error_free(local_err);
+    local_err = NULL;
 
     if (linux_sys_state_supports_mode(mode, &local_err)) {
         mode_supported = true;
@@ -1791,6 +1793,7 @@ static void guest_suspend(SuspendMode mode, Error **errp)
     }
 
     if (!mode_supported) {
+        error_free(local_err);
         error_setg(errp,
                    "the requested suspend mode is not supported by the guest");
     } else {