Skip to content

Commit

Permalink
Make sure /etc/mender/scripts/version is closed after use.
Browse files Browse the repository at this point in the history
Changelog: Fix a (possible) file descriptor leak.

Signed-off-by: Kristian Amlie <kristian.amlie@northern.tech>
  • Loading branch information
kacf committed Jan 10, 2022
1 parent b39db61 commit 922875e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion statescript/executor.go
@@ -1,4 +1,4 @@
// Copyright 2021 Northern.tech AS
// Copyright 2022 Northern.tech AS
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -121,6 +121,7 @@ func (l Launcher) CheckRootfsScriptsVersion() error {
} else if err != nil {
return errors.Wrap(err, "statescript")
}
defer f.Close()
ver, err := readVersion(f)
if _, ok := err.(readVersionParseError); ok {
errmsg := "statescript: Failed to parse the version file in the statescript" +
Expand Down

0 comments on commit 922875e

Please sign in to comment.