Skip to content

Commit

Permalink
Fix more big memory leaks
Browse files Browse the repository at this point in the history
  • Loading branch information
XVilka committed Jul 30, 2017
1 parent c1472e6 commit 246dd7f
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions libr/bin/format/pe/pe.c
Original file line number Diff line number Diff line change
Expand Up @@ -877,6 +877,7 @@ int PE_(bin_pe_get_overlay)(struct PE_(r_bin_pe_obj_t)* bin, ut64* size) {

if ((ut64) bin->size > largest_offset + largest_size) {
*size = bin->size - largest_offset - largest_size;
free (sects);
return largest_offset + largest_size;
}
free (sects);
Expand Down
1 change: 1 addition & 0 deletions libr/core/disasm.c
Original file line number Diff line number Diff line change
Expand Up @@ -3609,6 +3609,7 @@ R_API int r_core_print_disasm(RPrint *p, RCore *core, ut64 addr, ut8 *buf, int l
ds->vat = p2v (ds, ds->at);
if (r_cons_is_breaked ()) {
dorepeat = 0;
R_FREE (nbuf);
r_cons_break_pop ();
return 0; //break;
}
Expand Down
1 change: 1 addition & 0 deletions libr/core/project.c
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ R_API void r_core_project_execute_cmds(RCore *core, const char *prjfile) {
char *str = r_core_project_notes_file (core, prjfile);
char *data = r_file_slurp (str, NULL);
if (!data) {
free (str);
return;
}
Output out;
Expand Down
6 changes: 4 additions & 2 deletions libr/egg/egg.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,11 @@ R_API int r_egg_add (REgg *a, REggPlugin *foo) {
return false;
//if (foo->init)
// foo->init (a->user);
r_list_foreach (a->plugins, iter, h)
if (!strcmp (h->name, foo->name))
r_list_foreach (a->plugins, iter, h) {
if (!strcmp (h->name, foo->name)) {
return false;
}
}
r_list_append (a->plugins, foo);
return true;
}
Expand Down
3 changes: 2 additions & 1 deletion libr/egg/egg_lang.c
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ static void rcc_internal_mathop(REgg *egg, char *ptr, char *ep, char op) {
}
R_FREE (oldp);
R_FREE (ep);
R_FREE (p);
}

/*
Expand Down Expand Up @@ -1178,7 +1179,7 @@ static void rcc_next(REgg *egg) {
rcc_mathop (egg, &tmp, 2);
R_FREE (mathline);
tmp = NULL;
// following code block is too ugly, oh no
// following code block is too ugly, oh noes
p = r_egg_mkvar (egg, buf, ptr, 0);
if (is_var (p)) {
p = r_egg_mkvar (egg, buf, p, 0);
Expand Down
1 change: 1 addition & 0 deletions libr/io/p/io_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ static RRunProfile* _get_run_profile(RIO *io, int bits, char **argv) {
}
rp->_args[i] = NULL;
if (!argv[0]) {
r_run_free (rp);
return NULL;
}
rp->_program = strdup (argv[0]);
Expand Down

0 comments on commit 246dd7f

Please sign in to comment.