mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-30 05:21:55 -06:00
Fix use-after-free in util/error.c
-----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEEuBi5yt+QicLVzsZrda1lgCoLQhEFAmQu9xYACgkQda1lgCoL QhFX2ggAnZZF2KgvVSRh67X+3VdVsg+ifFc/k7kMq74UhTr4lXojPCcgSPu8PaRZ Mv0I+xNv9pjEU7frwi6vc9DXyhWrVTLgW4TugVBgsB75CnjvFN3lw3T9goCc1h4m eO7c6SMdUpyQG7ar1mqt2m0bjVz85OAsNYBiAjxfyrKzX6B/mHyru5re/8VC3Hho IJWGlS51IxrVq44qjB8Lh3voXiEru7dX/y86fWqAiy61pON6+A43rBDIb9JOVv8q QiHqXVjs9/ax9ZNRudlgJ7bAlUFp6vD9xBm6ztlABI9MCYZeibU6jPMLCBYnGiJq f//Sqqd4WsqnhOJOLYeMNfFMElIXEw== =uu4l -----END PGP SIGNATURE----- Merge tag 'pull_error_handle_fix_use_after_free.v1' of https://github.com/stefanberger/qemu-tpm into staging Fix use-after-free in util/error.c # -----BEGIN PGP SIGNATURE----- # # iQEzBAABCAAdFiEEuBi5yt+QicLVzsZrda1lgCoLQhEFAmQu9xYACgkQda1lgCoL # QhFX2ggAnZZF2KgvVSRh67X+3VdVsg+ifFc/k7kMq74UhTr4lXojPCcgSPu8PaRZ # Mv0I+xNv9pjEU7frwi6vc9DXyhWrVTLgW4TugVBgsB75CnjvFN3lw3T9goCc1h4m # eO7c6SMdUpyQG7ar1mqt2m0bjVz85OAsNYBiAjxfyrKzX6B/mHyru5re/8VC3Hho # IJWGlS51IxrVq44qjB8Lh3voXiEru7dX/y86fWqAiy61pON6+A43rBDIb9JOVv8q # QiHqXVjs9/ax9ZNRudlgJ7bAlUFp6vD9xBm6ztlABI9MCYZeibU6jPMLCBYnGiJq # f//Sqqd4WsqnhOJOLYeMNfFMElIXEw== # =uu4l # -----END PGP SIGNATURE----- # gpg: Signature made Thu 06 Apr 2023 17:45:10 BST # gpg: using RSA key B818B9CADF9089C2D5CEC66B75AD65802A0B4211 # gpg: Good signature from "Stefan Berger <stefanb@linux.vnet.ibm.com>" [unknown] # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: B818 B9CA DF90 89C2 D5CE C66B 75AD 6580 2A0B 4211 * tag 'pull_error_handle_fix_use_after_free.v1' of https://github.com/stefanberger/qemu-tpm: util/error: Fix use-after-free errors reported by Coverity Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
64f1c63d87
1 changed files with 4 additions and 6 deletions
10
util/error.c
10
util/error.c
|
@ -46,6 +46,10 @@ static void error_handle(Error **errp, Error *err)
|
||||||
}
|
}
|
||||||
if (errp == &error_warn) {
|
if (errp == &error_warn) {
|
||||||
warn_report_err(err);
|
warn_report_err(err);
|
||||||
|
} else if (errp && !*errp) {
|
||||||
|
*errp = err;
|
||||||
|
} else {
|
||||||
|
error_free(err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,7 +80,6 @@ static void error_setv(Error **errp,
|
||||||
err->func = func;
|
err->func = func;
|
||||||
|
|
||||||
error_handle(errp, err);
|
error_handle(errp, err);
|
||||||
*errp = err;
|
|
||||||
|
|
||||||
errno = saved_errno;
|
errno = saved_errno;
|
||||||
}
|
}
|
||||||
|
@ -289,11 +292,6 @@ void error_propagate(Error **dst_errp, Error *local_err)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
error_handle(dst_errp, local_err);
|
error_handle(dst_errp, local_err);
|
||||||
if (dst_errp && !*dst_errp) {
|
|
||||||
*dst_errp = local_err;
|
|
||||||
} else {
|
|
||||||
error_free(local_err);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void error_propagate_prepend(Error **dst_errp, Error *err,
|
void error_propagate_prepend(Error **dst_errp, Error *err,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue