X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=http-push.c;h=fc013ec139bd066a4d32357d7508d10c82b6f873;hb=e1355547fd30b21fbdc3fe4e576759683777c4ce;hp=76c788673e0a02c723d99976d3e605531341c7a9;hpb=56fc63193975edd4b9f520b6c65c2b97ecd8ee38;p=git.git diff --git a/http-push.c b/http-push.c index 76c78867..fc013ec1 100644 --- a/http-push.c +++ b/http-push.c @@ -784,7 +784,7 @@ static void handle_new_lock_ctx(struct xml_ctx *ctx, int tag_closed) strtol(ctx->cdata + 7, NULL, 10); } else if (!strcmp(ctx->name, DAV_ACTIVELOCK_TOKEN)) { if (!strncmp(ctx->cdata, "opaquelocktoken:", 16)) { - lock->token = xmalloc(strlen(ctx->cdata - 15)); + lock->token = xmalloc(strlen(ctx->cdata) - 15); strcpy(lock->token, ctx->cdata + 16); } } @@ -1008,9 +1008,7 @@ static int unlock_remote(struct active_lock *lock) if (lock->owner != NULL) free(lock->owner); free(lock->url); -/* Freeing the token causes a segfault... free(lock->token); -*/ free(lock); return rc; @@ -1273,6 +1271,9 @@ int main(int argc, char **argv) break; } + if (!remote->url) + usage(http_push_usage); + memset(remote_dir_exists, 0, 256); http_init();