Fix some startup valgrind warnings

This commit is contained in:
pancake 2013-11-25 00:45:18 +01:00
parent ee62e9d1b9
commit 904751ce86
4 changed files with 15 additions and 13 deletions

View File

@ -146,6 +146,7 @@ R_API int r_bin_load_languages(RBin *bin) {
return R_BIN_NM_CXX;
return R_BIN_NM_NONE;
}
static void set_bin_items(RBin *bin, RBinPlugin *cp) {
RBinArch *a = &bin->cur;
@ -171,9 +172,6 @@ static void set_bin_items(RBin *bin, RBinPlugin *cp) {
if (cp->classes) o->classes = cp->classes (a);
if (cp->lines) o->lines = cp->lines (a);
o->lang = r_bin_load_languages (bin);
}
R_API int r_bin_io_load(RBin *bin, RIO *io, RIODesc *desc, int dummy) {
@ -326,7 +324,6 @@ static void r_bin_free_items(RBin *bin) {
a->curplugin->destroy (a);
}
static void r_bin_init(RBin *bin, int rawstr) {
RListIter *it;
RBinXtrPlugin *xtr;
@ -695,10 +692,9 @@ R_API int r_bin_class_add_method (RBin *bin, const char *classname, const char *
if (c) {
r_list_append (c->methods, (void*)name);
return R_TRUE;
} else {
c = r_bin_class_new (bin, classname, NULL, 0);
r_list_append (c->methods, (void*)name);
}
c = r_bin_class_new (bin, classname, NULL, 0);
r_list_append (c->methods, (void*)name);
return R_FALSE;
}
@ -713,7 +709,7 @@ R_API ut64 r_bin_get_offset (RBin *bin) {
R_API ut64 r_bin_get_vaddr (RBin *bin, ut64 baddr, ut64 paddr, ut64 vaddr) {
RBinPlugin *cp = bin->cur.curplugin;
if(cp && cp->get_vaddr)
if (cp && cp->get_vaddr)
return cp->get_vaddr (baddr, paddr, vaddr);
ut32 delta;

View File

@ -1,4 +1,4 @@
/* radare - LGPL - Copyright 2011-2012 - pancake */
/* radare - LGPL - Copyright 2011-2013 - pancake */
#include <r_types.h>
#include <r_util.h>
@ -15,9 +15,11 @@ static char *fsname(RBinArch *arch) {
for (i=0; fstypes[i].name; i++) {
RFSType *f = &fstypes[i];
len = R_MIN (f->buflen, sizeof (buf));
memset (buf, 0, sizeof (buf));
r_buf_read_at (arch->buf, f->bufoff, buf, len);
if ((f->buflen>0) && (len>=f->buflen)) {
if (!memcmp (buf, f->buf, f->buflen)) {
int min = R_MIN (f->buflen, sizeof (buf));
if (!memcmp (buf, f->buf, min)) {
ret = R_TRUE;
len = R_MIN (f->bytelen, sizeof (buf));
r_buf_read_at (arch->buf, f->byteoff, buf, len);

View File

@ -487,7 +487,7 @@ static int cmd_help(void *data, const char *input) {
" y [len] [off] yank/paste bytes from/to memory\n"
" ?[??] [expr] help or evaluate math expression\n"
" ?$? show available '$' variables\n"
" ?@? show help for '@' and '~' suffix\n"
" ?@? show help for '@' (seek) and '~' (grep) suffix (see ~??)\n"
);
break;
}

View File

@ -66,7 +66,9 @@ R_API int r_sandbox_open (const char *path, int mode, int perm) {
#if __WINDOWS__
perm = 0;
#endif
return open (path, mode, perm);
if (path)
return open (path, mode, perm);
return -1;
}
R_API FILE *r_sandbox_fopen (const char *path, const char *mode) {
@ -76,7 +78,9 @@ R_API FILE *r_sandbox_fopen (const char *path, const char *mode) {
if (!r_sandbox_check_path (path))
return NULL;
}
return fopen (path, mode);
if (path)
return fopen (path, mode);
return NULL;
}
R_API int r_sandbox_chdir (const char *path) {