Commit 14d30cd
ref-filter: fix memory leak in
We treat the `value` pointer as a pointer to a struct and free its `s`
field. But `value` is in fact an array of structs. As a result, we only
free the first `s` out of `used_atom_cnt`-many and leak the rest. Make
sure we free all items in `value`.
In the caller, `ref_array_clear()`, this means we need to be careful not
to zero `used_atom_cnt` until after we've called `free_array_item()`. We
could move just a single line, but let's keep related things close
together instead, by first handling `array`, then `used_atom`.
Signed-off-by: Martin Ågren <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>free_array_item()
1 parent 6d5b264 commit 14d30cd
1 file changed
+9
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2105 | 2105 | | |
2106 | 2106 | | |
2107 | 2107 | | |
2108 | | - | |
| 2108 | + | |
| 2109 | + | |
| 2110 | + | |
2109 | 2111 | | |
2110 | 2112 | | |
2111 | 2113 | | |
| |||
2116 | 2118 | | |
2117 | 2119 | | |
2118 | 2120 | | |
2119 | | - | |
2120 | | - | |
2121 | | - | |
2122 | | - | |
2123 | 2121 | | |
2124 | 2122 | | |
2125 | 2123 | | |
2126 | 2124 | | |
| 2125 | + | |
| 2126 | + | |
| 2127 | + | |
| 2128 | + | |
| 2129 | + | |
| 2130 | + | |
2127 | 2131 | | |
2128 | 2132 | | |
2129 | 2133 | | |
| |||
0 commit comments