Skip to content

Commit e5ff6a6

Browse files
radaretrufae
authored andcommitted
Fix few more leaks for zip0:// and the macho parser
1 parent f15ab9a commit e5ff6a6

File tree

4 files changed

+16
-2
lines changed

4 files changed

+16
-2
lines changed

libr/bin/format/mach0/mach0.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3261,15 +3261,17 @@ static bool is_debug_build(RBinFile *bf, struct MACH0_(obj_t) *mo) {
32613261
return false;
32623262
}
32633263

3264+
bool res = false;
32643265
RListIter *iter;
32653266
RBinSection *section;
32663267
r_list_foreach (sections, iter, section) {
32673268
if (strstr (section->name, ".__debug_line")) {
3268-
return true;
3269+
res = true;
3270+
break;
32693271
}
32703272
}
32713273
r_list_free (sections);
3272-
return false;
3274+
return res;
32733275
}
32743276
#endif
32753277

libr/core/cfile.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -983,6 +983,7 @@ R_API RIODesc *r_core_file_open_many(RCore *r, const char *file, int perm, ut64
983983
r_esil_setup (r->anal->esil, r->anal, 0, 0, false);
984984
}
985985
}
986+
r_list_free (list_fds);
986987
return first;
987988
}
988989

libr/io/p/io_zip.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ static void r_io_zip_free_zipfileobj(RIOZipFileObj *zfo) {
221221
if (zfo->modified) {
222222
r_io_zip_flush_file (zfo);
223223
}
224+
free (zfo->archivename);
224225
free (zfo->name);
225226
free (zfo->password);
226227
r_unref (zfo->b);

test/db/leak/open

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,13 @@ EXPECT=<<EOF
7070
hello
7171
EOF
7272
RUN
73+
74+
NAME=macho zip
75+
FILE=zip0://bins/mach0/io.zip
76+
CMDS=<<EOF
77+
?e hello
78+
EOF
79+
EXPECT=<<EOF
80+
hello
81+
EOF
82+
RUN

0 commit comments

Comments
 (0)