[PATCH] http-push: update memory allocation for http headers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In 753bc91 (Remove the requirement opaquelocktoken uri scheme), the
header strings were with the removal "opaquelocktoken:" (16
characters).

Unfortunately, this was without the corresponding change in memory
allocation. In this patch we update these allocations.

Signed-off-by: Tay Ray Chuan <rctay89@xxxxxxxxx>
---
 http-push.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/http-push.c b/http-push.c
index a4b7d08..a6522dd 100644
--- a/http-push.c
+++ b/http-push.c
@@ -595,7 +595,7 @@ static int refresh_lock(struct remote_lock *lock)

 	lock->refreshing = 1;

-	if_header = xmalloc(strlen(lock->token) + 25);
+	if_header = xmalloc(strlen(lock->token) + 9);
 	sprintf(if_header, "If: (<%s>)", lock->token);
 	sprintf(timeout_header, "Timeout: Second-%ld", lock->timeout);
 	dav_headers = curl_slist_append(dav_headers, if_header);
@@ -1306,7 +1306,7 @@ static int unlock_remote(struct remote_lock *lock)
 	struct curl_slist *dav_headers = NULL;
 	int rc = 0;

-	lock_token_header = xmalloc(strlen(lock->token) + 31);
+	lock_token_header = xmalloc(strlen(lock->token) + 15);
 	sprintf(lock_token_header, "Lock-Token: <%s>",
 		lock->token);
 	dav_headers = curl_slist_append(dav_headers, lock_token_header);
@@ -1730,7 +1730,7 @@ static int update_remote(unsigned char *sha1,
struct remote_lock *lock)
 	struct buffer out_buffer = { STRBUF_INIT, 0 };
 	struct curl_slist *dav_headers = NULL;

-	if_header = xmalloc(strlen(lock->token) + 25);
+	if_header = xmalloc(strlen(lock->token) + 9);
 	sprintf(if_header, "If: (<%s>)", lock->token);
 	dav_headers = curl_slist_append(dav_headers, if_header);

@@ -1949,7 +1949,7 @@ static void update_remote_info_refs(struct
remote_lock *lock)
 	remote_ls("refs/", (PROCESS_FILES | RECURSIVE),
 		  add_remote_info_ref, &buffer.buf);
 	if (!aborted) {
-		if_header = xmalloc(strlen(lock->token) + 25);
+		if_header = xmalloc(strlen(lock->token) + 9);
 		sprintf(if_header, "If: (<%s>)", lock->token);
 		dav_headers = curl_slist_append(dav_headers, if_header);

-- 
1.6.0.4
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux