summaryrefslogtreecommitdiff
path: root/http-push.c
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2017-06-15 23:15:46 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-06-16 19:44:03 (GMT)
commit6a83d902073803c4141e02c53decf8c03e35da27 (patch)
tree209cf1639a325875240fce3e1f1cabbdb25878df /http-push.c
parentcf9f49ea4817b36e93e64909a918a912cc32c28b (diff)
downloadgit-6a83d902073803c4141e02c53decf8c03e35da27.zip
git-6a83d902073803c4141e02c53decf8c03e35da27.tar.gz
git-6a83d902073803c4141e02c53decf8c03e35da27.tar.bz2
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 'http-push.c')
-rw-r--r--http-push.c24
1 files changed, 8 insertions, 16 deletions
diff --git a/http-push.c b/http-push.c
index 67c4d4b..c91f40a 100644
--- a/http-push.c
+++ b/http-push.c
@@ -291,8 +291,7 @@ static void start_mkcol(struct transfer_request *request)
request->state = RUN_MKCOL;
} else {
request->state = ABORTED;
- free(request->url);
- request->url = NULL;
+ FREE_AND_NULL(request->url);
}
}
#endif
@@ -409,8 +408,7 @@ static void start_put(struct transfer_request *request)
request->state = RUN_PUT;
} else {
request->state = ABORTED;
- free(request->url);
- request->url = NULL;
+ FREE_AND_NULL(request->url);
}
}
@@ -432,8 +430,7 @@ static void start_move(struct transfer_request *request)
request->state = RUN_MOVE;
} else {
request->state = ABORTED;
- free(request->url);
- request->url = NULL;
+ FREE_AND_NULL(request->url);
}
}
@@ -526,8 +523,7 @@ static void finish_request(struct transfer_request *request)
/* URL is reused for MOVE after PUT */
if (request->state != RUN_PUT) {
- free(request->url);
- request->url = NULL;
+ FREE_AND_NULL(request->url);
}
if (request->state == RUN_MKCOL) {
@@ -803,8 +799,7 @@ xml_start_tag(void *userData, const char *name, const char **atts)
}
xsnprintf(ctx->name + old_namelen, ctx->len - old_namelen, ".%s", c);
- free(ctx->cdata);
- ctx->cdata = NULL;
+ FREE_AND_NULL(ctx->cdata);
ctx->userFunc(ctx, 0);
}
@@ -932,8 +927,7 @@ static struct remote_lock *lock_remote(const char *path, long timeout)
free(lock->token);
free(lock->owner);
free(url);
- free(lock);
- lock = NULL;
+ FREE_AND_NULL(lock);
} else {
lock->url = url;
lock->start_time = time(NULL);
@@ -1105,8 +1099,7 @@ static void handle_remote_ls_ctx(struct xml_ctx *ctx, int tag_closed)
ls->dentry_flags |= IS_DIR;
}
} else if (!strcmp(ctx->name, DAV_PROPFIND_RESP)) {
- free(ls->dentry_name);
- ls->dentry_name = NULL;
+ FREE_AND_NULL(ls->dentry_name);
ls->dentry_flags = 0;
}
}
@@ -1547,8 +1540,7 @@ static void fetch_symref(const char *path, char **symref, struct object_id *oid)
curl_errorstr);
free(url);
- free(*symref);
- *symref = NULL;
+ FREE_AND_NULL(*symref);
oidclr(oid);
if (buffer.len == 0)