tools: Remove redundant NULL checks before free() (found by Smatch).
This commit is contained in:
parent
5cecceccb2
commit
0fb444b58c
|
@ -1179,7 +1179,7 @@ static typeref_t *uniq_tref(typeref_t *ref)
|
||||||
static type_t *type_ref(typeref_t *ref)
|
static type_t *type_ref(typeref_t *ref)
|
||||||
{
|
{
|
||||||
type_t *t = ref->ref;
|
type_t *t = ref->ref;
|
||||||
if (ref->name) free(ref->name);
|
free(ref->name);
|
||||||
free(ref);
|
free(ref);
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ typedef struct _compound_type
|
||||||
#define INIT_CT(ct) do { memset (&ct, 0, sizeof (ct)); } while (0)
|
#define INIT_CT(ct) do { memset (&ct, 0, sizeof (ct)); } while (0)
|
||||||
|
|
||||||
/* free the memory used by a compound structure */
|
/* free the memory used by a compound structure */
|
||||||
#define FREE_CT(ct) do { if (ct.expression) free (ct.expression); } while (0)
|
#define FREE_CT(ct) free (ct.expression)
|
||||||
|
|
||||||
/* Flags for data types */
|
/* Flags for data types */
|
||||||
#define DATA_VTABLE 0x1
|
#define DATA_VTABLE 0x1
|
||||||
|
|
|
@ -348,10 +348,7 @@ static const char *get_type (parsed_symbol *sym, const char *proto, int arg)
|
||||||
void search_cleanup (void) __attribute__ ((destructor));
|
void search_cleanup (void) __attribute__ ((destructor));
|
||||||
void search_cleanup (void)
|
void search_cleanup (void)
|
||||||
{
|
{
|
||||||
if (grep_buff)
|
free (grep_buff);
|
||||||
free (grep_buff);
|
free (fgrep_buff);
|
||||||
|
|
||||||
if (fgrep_buff)
|
|
||||||
free (fgrep_buff);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -109,19 +109,13 @@ void symbol_clear(parsed_symbol *sym)
|
||||||
assert (sym->symbol);
|
assert (sym->symbol);
|
||||||
|
|
||||||
free (sym->symbol);
|
free (sym->symbol);
|
||||||
|
free (sym->return_text);
|
||||||
if (sym->return_text)
|
free (sym->function_name);
|
||||||
free (sym->return_text);
|
|
||||||
|
|
||||||
if (sym->function_name)
|
|
||||||
free (sym->function_name);
|
|
||||||
|
|
||||||
for (i = sym->argc - 1; i >= 0; i--)
|
for (i = sym->argc - 1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
if (sym->arg_text [i])
|
free (sym->arg_text [i]);
|
||||||
free (sym->arg_text [i]);
|
free (sym->arg_name [i]);
|
||||||
if (sym->arg_name [i])
|
|
||||||
free (sym->arg_name [i]);
|
|
||||||
}
|
}
|
||||||
memset (sym, 0, sizeof (parsed_symbol));
|
memset (sym, 0, sizeof (parsed_symbol));
|
||||||
}
|
}
|
||||||
|
|
|
@ -274,8 +274,7 @@ void write_h_file(const char *fname)
|
||||||
internal_error(__FILE__, __LINE__, "Invalid base for number print");
|
internal_error(__FILE__, __LINE__, "Invalid base for number print");
|
||||||
}
|
}
|
||||||
free(cptr);
|
free(cptr);
|
||||||
if(cast)
|
free(cast);
|
||||||
free(cast);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
internal_error(__FILE__, __LINE__, "Invalid node type %d", ndp->type);
|
internal_error(__FILE__, __LINE__, "Invalid node type %d", ndp->type);
|
||||||
|
|
|
@ -2906,10 +2906,8 @@ static resource_t *build_fontdirs(resource_t *tail)
|
||||||
|
|
||||||
free(lanfnt);
|
free(lanfnt);
|
||||||
clean:
|
clean:
|
||||||
if(fnt)
|
free(fnt);
|
||||||
free(fnt);
|
free(fnd);
|
||||||
if(fnd)
|
|
||||||
free(fnd);
|
|
||||||
free(str.str.cstr);
|
free(str.str.cstr);
|
||||||
return lst;
|
return lst;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue