http-fetch: do not use curl_message after releasing it
[git.git] / patch-delta.c
index 26281ea..98c27be 100644 (file)
@@ -34,9 +34,10 @@ void *patch_delta(void *src_buf, unsigned long src_size,
 
        /* now the result size */
        size = get_delta_hdr_size(&data);
-       dst_buf = malloc(size);
+       dst_buf = malloc(size + 1);
        if (!dst_buf)
                return NULL;
+       dst_buf[size] = 0;
 
        out = dst_buf;
        while (data < top) {