Commit 0016876
committed
pack-bitmap: fix memory leak if
In pack-bitmap.c:load_bitmap_entries_v1, the function `read_bitmap_1`
allocates a bitmap and reads index data into it. However, if any of
the validation checks following the allocation fail, the allocated bitmap
is not freed, resulting in a memory leak. To avoid this, the validation
checks should be performed before the bitmap is allocated.
Signed-off-by: Lidong Yan <[email protected]>load_bitmap_entries_v1 failed1 parent 6f84262 commit 0016876
1 file changed
+4
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
388 | 388 | | |
389 | 389 | | |
390 | 390 | | |
391 | | - | |
392 | | - | |
393 | | - | |
394 | | - | |
395 | 391 | | |
396 | 392 | | |
397 | 393 | | |
| |||
402 | 398 | | |
403 | 399 | | |
404 | 400 | | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
405 | 405 | | |
406 | 406 | | |
407 | 407 | | |
| |||
0 commit comments