* Fix some valgrind warnings

This commit is contained in:
pancake 2011-04-06 11:35:18 +02:00
parent 94e316b6fe
commit fd8545e76e
4 changed files with 12 additions and 12 deletions

View File

@ -135,7 +135,7 @@ static char *filter_refline(const char *str) {
static void r_print_disasm(RPrint *p, RCore *core, ut64 addr, ut8 *buf, int len, int l) {
RAnalCC cc = {0};
RAnalFcn *f = NULL;
int ret, idx, i, j, k, lines, ostackptr, stackptr = 0;
int ret, idx, i, j, k, lines, ostackptr = 0, stackptr = 0;
int counter = 0;
int middle = 0;
char str[128], strsub[128];
@ -4238,12 +4238,12 @@ R_API int r_core_cmd_foreach(RCore *core, const char *cmd, char *each) {
return R_TRUE;
}
R_API int r_core_cmd(RCore *core, const char *command, int log) {
R_API int r_core_cmd(RCore *core, const char *cstr, int log) {
int len, rep, ret = R_FALSE;
char *cmd, *ocmd;
if (command != NULL) {
/* list command plugins */
if (!strcmp (command, ":")) {
if (cstr && *cstr) {
/* list cstr plugins */
if (!strcmp (cstr, ":")) {
RListIter *iter = r_list_iterator (core->cmd->plist);
while (r_list_iter_next (iter)) {
RCmdPlugin *cp = (RCmdPlugin*) r_list_iter_get (iter);
@ -4251,11 +4251,11 @@ R_API int r_core_cmd(RCore *core, const char *command, int log) {
}
return 0;
}
len = strlen (command)+1;
len = strlen (cstr)+1;
ocmd = cmd = malloc (len+8192);
if (ocmd == NULL)
return R_FALSE;
memcpy (cmd, command, len);
strcpy (cmd, cstr);
cmd = r_str_trim_head_tail (cmd);
rep = atoi (cmd);
@ -4271,7 +4271,7 @@ R_API int r_core_cmd(RCore *core, const char *command, int log) {
}
}
if (log) r_line_hist_add (command);
if (log) r_line_hist_add (cstr);
free (core->oobi);
free (ocmd);

View File

@ -59,7 +59,7 @@ R_API int r_flag_name_filter(char *name) {
break;
}
if (!r_flag_name_validate_char (*name)) {
strcpy (name, name+1);
r_str_ccpy (name, name+1, 0);
name = name -1;
}
}

View File

@ -15,6 +15,7 @@ R_API struct r_io_t *r_io_new() {
io->redirect = NULL;
io->printf = (void*) printf;
io->plugin = NULL;
io->raised = -1;
r_io_cache_init (io);
r_io_map_init (io);
r_io_section_init (io);

View File

@ -21,16 +21,15 @@ R_API RIOMap *r_io_map_resolve(struct r_io_t *io, int fd) {
}
R_API int r_io_map_del(struct r_io_t *io, int fd) {
int ret = R_FALSE;
RIOMap *map;
RListIter *iter;
r_list_foreach (io->maps, iter, map) {
if (fd==-1 || map->fd==fd) {
r_list_delete (io->maps, iter);
ret = R_TRUE;
return R_TRUE;
}
}
return ret;
return R_FALSE;
}
R_API RIOMap *r_io_map_add(struct r_io_t *io, int fd, int flags, ut64 delta, ut64 offset, ut64 size) {