diff options
author | Junio C Hamano <junkio@cox.net> | 2006-08-27 21:19:39 -0700 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2006-08-27 21:19:39 -0700 |
commit | 4cac42b1324951579036a9d3ac403f5c2c3eeed8 (patch) | |
tree | 5106e1aff2bd1d90fef4c26550b777dbe1142429 /http-push.c | |
parent | b3c952f8386cebe12fc95227866683bb1cec99a9 (diff) | |
download | git-4cac42b1324951579036a9d3ac403f5c2c3eeed8.tar.gz git-4cac42b1324951579036a9d3ac403f5c2c3eeed8.tar.xz |
free(NULL) is perfectly valid.
Jonas noticed some places say "if (X) free(X)" which is totally
unnecessary.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'http-push.c')
-rw-r--r-- | http-push.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/http-push.c b/http-push.c index 04cb238e9..7814666d8 100644 --- a/http-push.c +++ b/http-push.c @@ -1238,10 +1238,8 @@ xml_start_tag(void *userData, const char *name, const char **atts) strcat(ctx->name, "."); strcat(ctx->name, c); - if (ctx->cdata) { - free(ctx->cdata); - ctx->cdata = NULL; - } + free(ctx->cdata); + ctx->cdata = NULL; ctx->userFunc(ctx, 0); } @@ -1268,8 +1266,7 @@ static void xml_cdata(void *userData, const XML_Char *s, int len) { struct xml_ctx *ctx = (struct xml_ctx *)userData; - if (ctx->cdata) - free(ctx->cdata); + free(ctx->cdata); ctx->cdata = xmalloc(len + 1); strlcpy(ctx->cdata, s, len + 1); } @@ -1518,9 +1515,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)) { - if (ls->dentry_name) { - free(ls->dentry_name); - } + free(ls->dentry_name); ls->dentry_name = NULL; ls->dentry_flags = 0; } |