-
Notifications
You must be signed in to change notification settings - Fork 14
Commit 6953b62
util: Don't leak a file descriptor in read_file
If memory allocation fails, we should close the file descriptor
before returning the error.
Also remove unneeded parentheses on return, return isn't a function.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Fixes: 2339e72 ("util: Add read_file() function for reading sysfs files")1 parent 2dd4896 commit 6953b62
2 files changed
+10
-5
lines changedOriginal file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 | + | ||
2 | + | ||
3 | + | ||
4 | + | ||
1 | 5 |
| |
2 | 6 |
| |
3 | 7 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
113 | 113 |
| |
114 | 114 |
| |
115 | 115 |
| |
116 | - | ||
116 | + | ||
117 | 117 |
| |
118 | 118 |
| |
119 | 119 |
| |
120 | 120 |
| |
121 | 121 |
| |
122 | - | ||
122 | + | ||
123 | 123 |
| |
124 | 124 |
| |
125 | 125 |
| |
| |||
129 | 129 |
| |
130 | 130 |
| |
131 | 131 |
| |
132 | - | ||
133 | 132 |
| |
134 | 133 |
| |
135 | - | ||
134 | + | ||
135 | + | ||
136 | 136 |
| |
137 | 137 |
| |
138 | 138 |
| |
139 | 139 |
| |
140 | 140 |
| |
141 | 141 |
| |
142 | 142 |
| |
143 | - | ||
144 | 143 |
| |
144 | + | ||
145 | + | ||
145 | 146 |
| |
146 | 147 |
| |
147 | 148 |
| |
|
0 commit comments