Fix various clang-analyser issues

This commit is contained in:
jvoisin 2015-08-28 18:29:31 +02:00
parent 98bb29c4ed
commit e0e170c3c5
7 changed files with 10 additions and 5 deletions

View File

@ -265,6 +265,7 @@ int main(int argc, char **argv) {
sequence = strdup (optarg);
break;
default:
free (sequence);
return 1;
}
}

View File

@ -272,7 +272,9 @@ int main(int argc, char **argv) {
while ((c = getopt (argc, argv, "jdDrvea:i:S:s:x:b:nBhf:t:kLq")) != -1) {
switch (c) {
case 'q': quiet = 1; break;
case 'i': iterations = atoi (optarg);
case 'i':
if (!optarg) return 1;
iterations = atoi (optarg);
if (iterations<0) {
eprintf ("error: -i argument must be positive\n");
return 1;

View File

@ -1179,7 +1179,7 @@ static int esil_deceq (RAnalEsil *esil) {
static int esil_poke1(RAnalEsil *esil) {
int ret = 0;
ut64 num, addr;
ut8 num1;
ut8 num1 = 0;
char *dst = r_anal_esil_pop (esil);
char *src = r_anal_esil_pop (esil);
if (src && r_anal_esil_get_parm (esil, src, &num)) {

View File

@ -178,7 +178,7 @@ static void copy_sym_name_with_namespace (char *class_name,
size_t len = 0;
char *tmp = 0;
len = strlen (class_name);
len = class_name ? strlen (class_name) : 0;
memcpy (sym->classname, class_name,
(len < R_BIN_SIZEOF_STRINGS) ?
len : R_BIN_SIZEOF_STRINGS);

View File

@ -236,6 +236,8 @@ static int bin_pe_parse_imports(struct PE_(r_bin_pe_obj_t)* bin, struct r_bin_pe
snprintf (import_name, PE_NAME_LENGTH, "%s_%s", dll_name, name);
}
if (!(*importp = realloc (*importp, (*nimp + 1) * sizeof(struct r_bin_pe_import_t)))) {
free (symdllname);
free (sdb_module);
r_sys_perror ("realloc (import)");
return R_FALSE;
}

View File

@ -516,7 +516,7 @@ static RBinInfo* info(RBinFile *arch) {
ret->lang = "c";
if (arch->file)
ret->file = strdup (arch->file);
else *ret->file = 0;
else ret->file = '\0';
if ((str = Elf_(r_bin_elf_get_rpath)(arch->o->bin_obj))) {
ret->rpath = strdup (str);
free (str);

View File

@ -1779,7 +1779,7 @@ R_API int r_core_visual(RCore *core, const char *input) {
color = r_config_get_i (core->config, "scr.color");
if (color) flags |= R_PRINT_FLAGS_COLOR;
debug = r_config_get_i (core->config, "cfg.debug");
flags = R_PRINT_FLAGS_ADDRMOD | R_PRINT_FLAGS_HEADER;
flags |= R_PRINT_FLAGS_ADDRMOD | R_PRINT_FLAGS_HEADER;
r_print_set_flags (core->print, core->print->flags);
scrseek = r_num_math (core->num,
r_config_get (core->config, "scr.seek"));