contrib/plugins/bbv.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
The file pointer can be NULL when e.g., opening the file failed.
vcpu_interval_exec() already implements a NULL-pointer check, but
plugin_exit() misses it. Handle the condition by adding the missing
check to plugin_exit().
Fixes: 0d279bec0f14 ("contrib/plugins: Add a plugin to generate basic block vectors")
Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
---
contrib/plugins/bbv.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/contrib/plugins/bbv.c b/contrib/plugins/bbv.c
index b9da6f815e36..5913cc6c637d 100644
--- a/contrib/plugins/bbv.c
+++ b/contrib/plugins/bbv.c
@@ -30,8 +30,13 @@ static uint64_t interval = 100000000;
static void plugin_exit(qemu_plugin_id_t id, void *p)
{
+ Vcpu *vcpu;
+
for (int i = 0; i < qemu_plugin_num_vcpus(); i++) {
- fclose(((Vcpu *)qemu_plugin_scoreboard_find(vcpus, i))->file);
+ vcpu = qemu_plugin_scoreboard_find(vcpus, i);
+ if (vcpu->file) {
+ fclose(vcpu->file);
+ }
}
g_hash_table_unref(bbs);
---
base-commit: ffcf1a7981793973ffbd8100a7c3c6042d02ae23
change-id: 20260307-bbv-2708e0023e0f
Best regards,
--
Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
On 3/6/26 7:22 PM, Akihiko Odaki wrote:
> The file pointer can be NULL when e.g., opening the file failed.
> vcpu_interval_exec() already implements a NULL-pointer check, but
> plugin_exit() misses it. Handle the condition by adding the missing
> check to plugin_exit().
>
> Fixes: 0d279bec0f14 ("contrib/plugins: Add a plugin to generate basic block vectors")
> Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
> ---
> contrib/plugins/bbv.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
This was merged into master (a8ff516c2f5ec05fb8b8bf4bceb88f49701f80d6).
Thank you for your contribution!
Regards,
Pierrick
On 3/6/26 7:22 PM, Akihiko Odaki wrote:
> The file pointer can be NULL when e.g., opening the file failed.
> vcpu_interval_exec() already implements a NULL-pointer check, but
> plugin_exit() misses it. Handle the condition by adding the missing
> check to plugin_exit().
>
> Fixes: 0d279bec0f14 ("contrib/plugins: Add a plugin to generate basic block vectors")
> Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
> ---
> contrib/plugins/bbv.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
On 7/3/26 04:22, Akihiko Odaki wrote:
> The file pointer can be NULL when e.g., opening the file failed.
> vcpu_interval_exec() already implements a NULL-pointer check, but
> plugin_exit() misses it. Handle the condition by adding the missing
> check to plugin_exit().
>
> Fixes: 0d279bec0f14 ("contrib/plugins: Add a plugin to generate basic block vectors")
> Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
> ---
> contrib/plugins/bbv.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
© 2016 - 2026 Red Hat, Inc.