Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions asm/assemble.c
Original file line number Diff line number Diff line change
Expand Up @@ -1016,8 +1016,7 @@ static int64_t assemble(insn *instruction)
" reading file `%s'", fname);
}
close_done:
if (buf)
nasm_free(buf);
nasm_free(buf);
if (map)
nasm_unmap_file(map, len);
fclose(fp);
Expand Down
6 changes: 2 additions & 4 deletions asm/labels.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,7 @@ static union label *find_label(const char *label, bool create, bool *created)
if (lptr || !create) {
if (created)
*created = false;
if (label_str)
nasm_free(label_str);
nasm_free(label_str);

return lptr;
}
Expand All @@ -232,8 +231,7 @@ static union label *find_label(const char *label, bool create, bool *created)
nasm_zero(*lfree);
lfree->defn.label = perm_copy(label);
lfree->defn.subsection = NO_SEG;
if (label_str)
nasm_free(label_str);
nasm_free(label_str);

hash_add(&ip, lfree->defn.label, lfree);
return lfree++;
Expand Down
3 changes: 1 addition & 2 deletions asm/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -618,8 +618,7 @@ static int parse_eops(extop **result, bool critical, int elem)
return oper_num;

fail:
if (eop)
nasm_free(eop);
nasm_free(eop);
return -1;
}

Expand Down
1 change: 0 additions & 1 deletion asm/preproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -950,7 +950,6 @@ static const char *pp_getenv(const Token *t, bool warn)
v = "";
}

if (buf)
nasm_free(buf);

return v;
Expand Down
6 changes: 2 additions & 4 deletions nasmlib/alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ void *nasm_realloc(void *q, size_t size)

void nasm_free(void *q)
{
if (q)
free(q);
free(q);
}

char *nasm_strdup(const char *s)
Expand Down Expand Up @@ -103,8 +102,7 @@ char *nasm_strdupto(char **ptrp, const char *str)
{
char *ptr = *ptrp;
if (str) {
if (ptr)
nasm_free(ptr);
nasm_free(ptr);
*ptrp = ptr = nasm_strdup(str);
}
return ptr;
Expand Down
3 changes: 1 addition & 2 deletions nasmlib/hashtbl.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,7 @@ void hash_free_all(struct hash_table *head, bool free_keys)
const struct hash_node *np;

hash_for_each(head, it, np) {
if (np->data)
nasm_free(np->data);
nasm_free(np->data);
if (free_keys && np->key)
nasm_free((void *)np->key);
}
Expand Down