Merge branch 'maint'

* maint:
  use xmemdupz() to allocate copies of strings given by start and length
  use xcalloc() to allocate zero-initialized memory
This commit is contained in:
Junio C Hamano
2014-07-21 12:35:39 -07:00
10 changed files with 10 additions and 27 deletions

View File

@ -2867,9 +2867,7 @@ static int apply_binary_fragment(struct image *img, struct patch *patch)
case BINARY_LITERAL_DEFLATED:
clear_image(img);
img->len = fragment->size;
img->buf = xmalloc(img->len+1);
memcpy(img->buf, fragment->patch, img->len);
img->buf[img->len] = '\0';
img->buf = xmemdupz(fragment->patch, img->len);
return 0;
}
return -1;