Remove unnecessary null pointer checks in fast-import.
There is no need to check for a NULL pointer before invoking free(), the runtime library automatically performs this check anyway and does nothing if a NULL pointer is supplied. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
This commit is contained in:
parent
c74ba3d344
commit
e7d06a4b70
@ -969,10 +969,9 @@ static int store_object(
|
|||||||
pack_size += s.total_out;
|
pack_size += s.total_out;
|
||||||
|
|
||||||
free(out);
|
free(out);
|
||||||
if (delta)
|
free(delta);
|
||||||
free(delta);
|
|
||||||
if (last) {
|
if (last) {
|
||||||
if (last->data && !last->no_free)
|
if (!last->no_free)
|
||||||
free(last->data);
|
free(last->data);
|
||||||
last->data = dat;
|
last->data = dat;
|
||||||
last->offset = e->offset;
|
last->offset = e->offset;
|
||||||
@ -1521,9 +1520,7 @@ static void file_change_m(struct branch *b)
|
|||||||
}
|
}
|
||||||
|
|
||||||
tree_content_set(&b->branch_tree, p, sha1, S_IFREG | mode);
|
tree_content_set(&b->branch_tree, p, sha1, S_IFREG | mode);
|
||||||
|
free(p_uq);
|
||||||
if (p_uq)
|
|
||||||
free(p_uq);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void file_change_d(struct branch *b)
|
static void file_change_d(struct branch *b)
|
||||||
@ -1539,8 +1536,7 @@ static void file_change_d(struct branch *b)
|
|||||||
p = p_uq;
|
p = p_uq;
|
||||||
}
|
}
|
||||||
tree_content_remove(&b->branch_tree, p);
|
tree_content_remove(&b->branch_tree, p);
|
||||||
if (p_uq)
|
free(p_uq);
|
||||||
free(p_uq);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cmd_from(struct branch *b)
|
static void cmd_from(struct branch *b)
|
||||||
@ -1719,8 +1715,7 @@ static void cmd_new_commit(void)
|
|||||||
sp += sprintf(sp, "%s\n\n", committer);
|
sp += sprintf(sp, "%s\n\n", committer);
|
||||||
memcpy(sp, msg, msglen);
|
memcpy(sp, msg, msglen);
|
||||||
sp += msglen;
|
sp += msglen;
|
||||||
if (author)
|
free(author);
|
||||||
free(author);
|
|
||||||
free(committer);
|
free(committer);
|
||||||
free(msg);
|
free(msg);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user