Commit 95d7ac8
committed
Fix nil pointer panic in commonLock defer
The defer function in commonLock calls file.Close() when an error
occurs, but file is always nil at that point. If os.Open or
os.OpenFile fails, file is nil. If platformSpecificLock fails, file
is closed inline and then set to nil by the return statement. In
both cases, calling file.Close() in the defer panics on a nil
pointer. Remove file.Close() from the defer function.
Signed-off-by: Federico Bramucci <163430291+fedebram@users.noreply.github.com>1 parent 0951079 commit 95d7ac8
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
| 54 | + | |
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| |||
0 commit comments