platform_system_core/libsparse
Robin Hsu 48c9f6196f libsparse: fix memory leak in output_file_close()
Fix memory leak in output_file_close():
Arguable whose resposibility to free structs allocated inside a file
struct (the caller or the library function), but the following protocol
(i.e. this fix) would better prevent memory leaks:
1) output_file_close() function will free those structs inside a file struct,
   right before closing the file.
   * Note: those structs are originally allocated by other libsparse function.
2) If the caller wants to clean up those struct inside a file struct,
   it may.  Just free those structs, and set the pointer to NULL.
   Afterward, when file_close()'s are called, they won't be free'ed twice.

Bug: 142483439
Test: verified by script MemLeak_LastCmd.sh (attached in Bugnizer)
Change-Id: I8bb9f7c9f7d19268663e2830d1a90d27bd5f99bd
Signed-off-by: Robin Hsu <robinhsu@google.com>
2019-11-12 18:52:29 +08:00
..
include/sparse Revert "libsparse: Add sparse typed callback" 2018-07-26 05:23:45 +00:00
.clang-format libsparse: Add .clang-format and reformat to google3 style 2018-06-13 20:32:24 +00:00
Android.bp Add fuzzer for libsparse 2019-09-25 13:27:52 -07:00
append2simg.cpp libsparse: Add .clang-format and reformat to google3 style 2018-06-13 20:32:24 +00:00
backed_block.cpp [libsparse] Modernize codebase by replacing NULL with nullptr 2018-07-23 23:32:01 +00:00
backed_block.h libsparse: Add .clang-format and reformat to google3 style 2018-06-13 20:32:24 +00:00
defs.h libsparse: Add .clang-format and reformat to google3 style 2018-06-13 20:32:24 +00:00
img2simg.cpp libsparse: Add .clang-format and reformat to google3 style 2018-06-13 20:32:24 +00:00
output_file.cpp libsparse: fix memory leak in output_file_close() 2019-11-12 18:52:29 +08:00
output_file.h Revert "libsparse: Add sparse typed callback" 2018-07-26 05:23:45 +00:00
OWNERS libsparse: add OWNERS. 2018-06-13 12:43:08 -07:00
simg2img.cpp libsparse: Add .clang-format and reformat to google3 style 2018-06-13 20:32:24 +00:00
simg2simg.cpp [libsparse] Modernize codebase by replacing NULL with nullptr 2018-07-23 23:32:01 +00:00
simg_dump.py libsparse: Add .csv and sha1 options for simg_dump.py 2016-10-03 15:34:37 -07:00
sparse.cpp Fix an unintialized return value. 2019-05-02 12:54:09 -07:00
sparse_crc32.cpp libsparse: Add .clang-format and reformat to google3 style 2018-06-13 20:32:24 +00:00
sparse_crc32.h libsparse: Add .clang-format and reformat to google3 style 2018-06-13 20:32:24 +00:00
sparse_defs.h libsparse: Add .clang-format and reformat to google3 style 2018-06-13 20:32:24 +00:00
sparse_err.cpp libsparse: Add .clang-format and reformat to google3 style 2018-06-13 20:32:24 +00:00
sparse_file.h libsparse: Add .clang-format and reformat to google3 style 2018-06-13 20:32:24 +00:00
sparse_format.h libsparse: Add .clang-format and reformat to google3 style 2018-06-13 20:32:24 +00:00
sparse_fuzzer.cpp Add fuzzer for libsparse 2019-09-25 13:27:52 -07:00
sparse_read.cpp [libsparse] Modernize codebase by replacing NULL with nullptr 2018-07-23 23:32:01 +00:00