Commit 635356e
UPSTREAM: fs/fat: Check malloc return values and fix memory leaks
Check malloc() return values and properly unwind on errors so
memory allocated for fat_itr structures get freed properly.
Also fixes a leak of fsdata.fatbuf in fat_size().
Fixes: 2460098 ("fs/fat: Reduce stack usage")
Change-Id: If2abd822a136b40375f6b0052c88c0d9deb3a632
Reported-by: Coverity (CID: 167225, 167233, 167234)
Signed-off-by: Tuomas Tynkkynen <[email protected]>
Reviewed-by: Tom Rini <[email protected]>
Signed-off-by: Kever Yang <[email protected]>
(cherry picked from commit af609e3)1 parent 86597fe commit 635356e
1 file changed
+20
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1038 | 1038 | | |
1039 | 1039 | | |
1040 | 1040 | | |
| 1041 | + | |
| 1042 | + | |
1041 | 1043 | | |
1042 | 1044 | | |
1043 | | - | |
| 1045 | + | |
1044 | 1046 | | |
1045 | 1047 | | |
1046 | 1048 | | |
| 1049 | + | |
1047 | 1050 | | |
1048 | 1051 | | |
1049 | 1052 | | |
| |||
1055 | 1058 | | |
1056 | 1059 | | |
1057 | 1060 | | |
| 1061 | + | |
| 1062 | + | |
1058 | 1063 | | |
1059 | 1064 | | |
1060 | | - | |
| 1065 | + | |
1061 | 1066 | | |
1062 | 1067 | | |
1063 | 1068 | | |
| |||
1071 | 1076 | | |
1072 | 1077 | | |
1073 | 1078 | | |
1074 | | - | |
| 1079 | + | |
1075 | 1080 | | |
1076 | 1081 | | |
1077 | 1082 | | |
| 1083 | + | |
1078 | 1084 | | |
1079 | | - | |
| 1085 | + | |
1080 | 1086 | | |
1081 | 1087 | | |
1082 | 1088 | | |
| |||
1089 | 1095 | | |
1090 | 1096 | | |
1091 | 1097 | | |
| 1098 | + | |
| 1099 | + | |
1092 | 1100 | | |
1093 | 1101 | | |
1094 | | - | |
| 1102 | + | |
1095 | 1103 | | |
1096 | 1104 | | |
1097 | 1105 | | |
1098 | | - | |
| 1106 | + | |
1099 | 1107 | | |
1100 | 1108 | | |
1101 | 1109 | | |
1102 | 1110 | | |
1103 | | - | |
| 1111 | + | |
1104 | 1112 | | |
| 1113 | + | |
1105 | 1114 | | |
1106 | 1115 | | |
1107 | 1116 | | |
| |||
1147 | 1156 | | |
1148 | 1157 | | |
1149 | 1158 | | |
1150 | | - | |
| 1159 | + | |
1151 | 1160 | | |
1152 | 1161 | | |
1153 | 1162 | | |
1154 | | - | |
| 1163 | + | |
1155 | 1164 | | |
1156 | 1165 | | |
1157 | 1166 | | |
1158 | 1167 | | |
1159 | | - | |
| 1168 | + | |
1160 | 1169 | | |
| 1170 | + | |
1161 | 1171 | | |
1162 | 1172 | | |
1163 | 1173 | | |
| |||
0 commit comments