aboutsummaryrefslogtreecommitdiff
path: root/transport-helper.c
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2017-06-15 23:15:46 +0000
committerJunio C Hamano <gitster@pobox.com>2017-06-16 12:44:03 -0700
commit6a83d902073803c4141e02c53decf8c03e35da27 (patch)
tree209cf1639a325875240fce3e1f1cabbdb25878df /transport-helper.c
parentcf9f49ea4817b36e93e64909a918a912cc32c28b (diff)
downloadgit-6a83d902073803c4141e02c53decf8c03e35da27.tar.gz
git-6a83d902073803c4141e02c53decf8c03e35da27.tar.xz
coccinelle: make use of the "type" FREE_AND_NULL() rule
Apply the result of the just-added coccinelle rule. This manually excludes a few occurrences, mostly things that resulted in many FREE_AND_NULL() on one line, that'll be manually fixed in a subsequent change. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'transport-helper.c')
-rw-r--r--transport-helper.c27
1 files changed, 9 insertions, 18 deletions
diff --git a/transport-helper.c b/transport-helper.c
index 36408046e..33cff38cc 100644
--- a/transport-helper.c
+++ b/transport-helper.c
@@ -242,8 +242,7 @@ static int disconnect_helper(struct transport *transport)
close(data->helper->out);
fclose(data->out);
res = finish_command(data->helper);
- free(data->helper);
- data->helper = NULL;
+ FREE_AND_NULL(data->helper);
}
return res;
}
@@ -711,43 +710,35 @@ static int push_update_ref_status(struct strbuf *buf,
if (!strcmp(msg, "no match")) {
status = REF_STATUS_NONE;
- free(msg);
- msg = NULL;
+ FREE_AND_NULL(msg);
}
else if (!strcmp(msg, "up to date")) {
status = REF_STATUS_UPTODATE;
- free(msg);
- msg = NULL;
+ FREE_AND_NULL(msg);
}
else if (!strcmp(msg, "non-fast forward")) {
status = REF_STATUS_REJECT_NONFASTFORWARD;
- free(msg);
- msg = NULL;
+ FREE_AND_NULL(msg);
}
else if (!strcmp(msg, "already exists")) {
status = REF_STATUS_REJECT_ALREADY_EXISTS;
- free(msg);
- msg = NULL;
+ FREE_AND_NULL(msg);
}
else if (!strcmp(msg, "fetch first")) {
status = REF_STATUS_REJECT_FETCH_FIRST;
- free(msg);
- msg = NULL;
+ FREE_AND_NULL(msg);
}
else if (!strcmp(msg, "needs force")) {
status = REF_STATUS_REJECT_NEEDS_FORCE;
- free(msg);
- msg = NULL;
+ FREE_AND_NULL(msg);
}
else if (!strcmp(msg, "stale info")) {
status = REF_STATUS_REJECT_STALE;
- free(msg);
- msg = NULL;
+ FREE_AND_NULL(msg);
}
else if (!strcmp(msg, "forced update")) {
forced = 1;
- free(msg);
- msg = NULL;
+ FREE_AND_NULL(msg);
}
}