Commit 57fb139
object-name: fix leaking commit list items
When calling `get_oid_oneline()`, we pass in a `struct commit_list` that
gets modified by the function. This creates a weird situation where the
commit list may sometimes be empty after returning, but sometimes it
will continue to carry additional commits. In those cases the remainder
of the list leaks.
Ultimately, the design where we only pass partial ownership to
`get_oid_oneline()` feels shoddy. Refactor the code such that we only
pass a constant pointer to the list, creating a local copy as needed.
Callers are thus always responsible for freeing the commit list, which
then allows us to plug a bunch of memory leaks.
Signed-off-by: Patrick Steinhardt <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>1 parent 11f841c commit 57fb139
File tree
3 files changed
+19
-10
lines changed- t
3 files changed
+19
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| |||
1254 | 1255 | | |
1255 | 1256 | | |
1256 | 1257 | | |
| 1258 | + | |
| 1259 | + | |
1257 | 1260 | | |
1258 | 1261 | | |
1259 | 1262 | | |
| |||
1388 | 1391 | | |
1389 | 1392 | | |
1390 | 1393 | | |
1391 | | - | |
| 1394 | + | |
1392 | 1395 | | |
1393 | | - | |
| 1396 | + | |
| 1397 | + | |
1394 | 1398 | | |
1395 | 1399 | | |
1396 | 1400 | | |
| |||
1411 | 1415 | | |
1412 | 1416 | | |
1413 | 1417 | | |
1414 | | - | |
| 1418 | + | |
1415 | 1419 | | |
1416 | | - | |
| 1420 | + | |
1417 | 1421 | | |
1418 | 1422 | | |
1419 | 1423 | | |
1420 | 1424 | | |
1421 | | - | |
| 1425 | + | |
1422 | 1426 | | |
1423 | 1427 | | |
1424 | 1428 | | |
| |||
1433 | 1437 | | |
1434 | 1438 | | |
1435 | 1439 | | |
1436 | | - | |
1437 | | - | |
| 1440 | + | |
1438 | 1441 | | |
1439 | | - | |
| 1442 | + | |
1440 | 1443 | | |
1441 | 1444 | | |
1442 | 1445 | | |
| |||
2024 | 2027 | | |
2025 | 2028 | | |
2026 | 2029 | | |
2027 | | - | |
| 2030 | + | |
| 2031 | + | |
| 2032 | + | |
| 2033 | + | |
2028 | 2034 | | |
2029 | 2035 | | |
2030 | 2036 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
| 5 | + | |
4 | 6 | | |
5 | 7 | | |
6 | 8 | | |
| |||
0 commit comments