From 3a5177b16d574c902183d1322367fe7db08fffc1 Mon Sep 17 00:00:00 2001 From: Rahul Chaudhry Date: Tue, 15 Nov 2016 16:18:46 -0800 Subject: bootable/recovery: cleanup compiler warnings (potential leak of memory) bootable/recovery/applypatch/imgdiff.cpp:1065:3: warning: Potential leak of memory pointed to by 'patch_data' bootable/recovery/applypatch/imgdiff.cpp:1065:3: warning: Potential leak of memory pointed to by 'patch_size' bootable/recovery/applypatch/imgdiff.cpp:226:7: warning: Potential leak of memory pointed to by 'temp_entries' Bug: 26936282 Test: WITH_TIDY=1 WITH_STATIC_ANALYZER=1 mm Change-Id: I3cac945d7677d367934d5619ef7419daf6f48d6f --- applypatch/imgdiff.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/applypatch/imgdiff.cpp b/applypatch/imgdiff.cpp index 7c5bb866d..e78a60477 100644 --- a/applypatch/imgdiff.cpp +++ b/applypatch/imgdiff.cpp @@ -224,6 +224,7 @@ unsigned char* ReadZip(const char* filename, for (i = 0; i < cdcount; ++i) { if (!(cd[0] == 0x50 && cd[1] == 0x4b && cd[2] == 0x01 && cd[3] == 0x02)) { printf("bad central directory entry %d\n", i); + free(temp_entries); return NULL; } @@ -1062,6 +1063,9 @@ int main(int argc, char** argv) { } } + free(patch_data); + free(patch_size); + fclose(f); return 0; -- cgit v1.2.3