From 7ec7d8cf54d8aab1c8a43a12ec42700be6e30a01 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Thu, 28 Mar 2024 21:15:38 +0100 Subject: [PATCH] cov: reset FILE on error path Although fclose() fails - we should not be retrying with already released stucture. --- lib/device/device_id.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/device/device_id.c b/lib/device/device_id.c index 200d39432..761dc60fe 100644 --- a/lib/device/device_id.c +++ b/lib/device/device_id.c @@ -1749,8 +1749,10 @@ int device_ids_write(struct cmd_context *cmd) goto_out; if (fsync(fileno(fp)) < 0) goto_out; - if (fclose(fp) < 0) + if (fclose(fp) < 0) { + fp = NULL; goto_out; + } fp = NULL;