Fix more recently introduced memleaks

This commit is contained in:
pancake 2021-05-21 11:17:32 +02:00
parent 5df2109526
commit d90510f951
4 changed files with 20 additions and 6 deletions

View File

@ -79,12 +79,12 @@ static ut64 baddr(RBinFile *bf) {
return 0;
}
static void addsym(RList *ret, const char *name, ut64 addr, ut32 size) {
static void addsym(RList *ret, char *name, ut64 addr, ut32 size) {
RBinSymbol *ptr = R_NEW0 (RBinSymbol);
if (!ptr) {
return;
}
ptr->name = strdup (r_str_get (name));
ptr->name = name;
ptr->paddr = ptr->vaddr = addr;
ptr->size = size;
ptr->ordinal = 0;

View File

@ -959,6 +959,7 @@ static void optimize(void) {
}
// eprintf ("FROM %d TO %d (%d)%c", I.context->buffer_len, len, codes, 10);
I.context->buffer_len = len;
free (oldstr);
}
R_API void r_cons_flush(void) {

View File

@ -1223,6 +1223,7 @@ R_API void r_core_file_reopen_debug(RCore *core, const char *args) {
if (strstr (bin_abspath, "://")) {
free (bin_abspath);
free (binpath);
r_list_free (old_sections);
return;
}
char *escaped_path = r_str_arg_escape (bin_abspath);

View File

@ -889,12 +889,19 @@ R_API void r_core_rtr_remove(RCore *core, const char *input) {
}
static char *errmsg_tmpfile = NULL;
static int errmsg_fd = -1;
R_API void r_core_rtr_event(RCore *core, const char *input) {
if (*input == '-') {
if (errmsg_tmpfile) {
r_file_rm (errmsg_tmpfile);
errmsg_tmpfile = NULL;
input++;
if (!strcmp (input, "errmsg")) {
if (errmsg_tmpfile) {
r_file_rm (errmsg_tmpfile);
errmsg_tmpfile = NULL;
if (errmsg_fd != -1) {
close (errmsg_fd);
}
}
}
return;
}
@ -910,7 +917,12 @@ R_API void r_core_rtr_event(RCore *core, const char *input) {
perror ("mkfifo");
} else {
int ff = open (f, O_RDWR);
dup2 (ff, 2);
if (ff != -1) {
dup2 (ff, 2);
errmsg_fd = ff;
} else {
eprintf ("Cannot open fifo: %s\n", f);
}
}
// r_core_event (core, );
free (s);