Commit 6dab49b
bundle-uri: plug leak in unbundle_from_file()
The function `unbundle_from_file()` has two memory leaks:
- We do not release the `struct bundle_header header` when hitting
errors because we return early without any cleanup.
- We do not release the `struct strbuf bundle_ref` at all.
Plug these leaks by creating a common exit path where both of these
variables are released.
While at it, refactor the code such that the variable assignments do not
happen inside the conditional statement itself according to our coding
style.
Signed-off-by: Toon Claes <[email protected]>
Acked-by: Patrick Steinhardt <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>1 parent 777489f commit 6dab49b
1 file changed
+13
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
368 | 368 | | |
369 | 369 | | |
370 | 370 | | |
371 | | - | |
372 | | - | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
373 | 376 | | |
374 | 377 | | |
375 | 378 | | |
376 | 379 | | |
377 | 380 | | |
378 | 381 | | |
379 | | - | |
380 | | - | |
381 | | - | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
382 | 388 | | |
383 | 389 | | |
384 | 390 | | |
| |||
407 | 413 | | |
408 | 414 | | |
409 | 415 | | |
| 416 | + | |
| 417 | + | |
410 | 418 | | |
411 | 419 | | |
412 | 420 | | |
| |||
0 commit comments