Skip to content

Commit 12925d7

Browse files
Rahul Chaudhrymsfjarvis
authored andcommitted
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
1 parent edd66b9 commit 12925d7

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

applypatch/imgdiff.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ unsigned char* ReadZip(const char* filename,
228228
for (i = 0; i < cdcount; ++i) {
229229
if (!(cd[0] == 0x50 && cd[1] == 0x4b && cd[2] == 0x01 && cd[3] == 0x02)) {
230230
printf("bad central directory entry %d\n", i);
231+
free(temp_entries);
231232
return NULL;
232233
}
233234

@@ -1077,6 +1078,9 @@ int main(int argc, char** argv) {
10771078
}
10781079
}
10791080

1081+
free(patch_data);
1082+
free(patch_size);
1083+
10801084
fclose(f);
10811085

10821086
return 0;

0 commit comments

Comments
 (0)