summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Kisiel <kamil@kamilkisiel.net>2015-02-23 18:52:10 +0300
committerKamil Kisiel <kamil@kamilkisiel.net>2015-02-23 18:52:35 +0300
commit39dd83d692d0cb984af851b38e89b0cd8ea302b6 (patch)
treeabf595ff660aa2c08b251c11a9d1d11b49274a17
parent13c86220d944600e7a6e3de6c87418896ccfbe77 (diff)
ensure FilesystemStore closes the file even on error.
Fixes #41
-rw-r--r--store.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/store.go b/store.go
index 5eaea81..b3461b0 100644
--- a/store.go
+++ b/store.go
@@ -222,10 +222,10 @@ func (s *FilesystemStore) save(session *Session) error {
if err != nil {
return err
}
+ defer fp.Close()
if _, err = fp.Write([]byte(encoded)); err != nil {
return err
}
- fp.Close()
return nil
}