Permalink
Browse files

Fix a memory leak that Clang Static Analyzer pointed out.

  • Loading branch information...
1 parent 62756a1 commit d873dd4184bfee0998fa4286ade75d1f45f9bad1 @ggcueroad ggcueroad committed Sep 11, 2012
Showing with 3 additions and 1 deletion.
  1. +3 −1 libarchive/archive_write_set_format_xar.c
@@ -3090,8 +3090,10 @@ save_xattrs(struct archive_write *a, struct file *file)
checksum_update(&(xar->a_sumwrk), value, size);
checksum_final(&(xar->a_sumwrk), &(heap->a_sum));
if (write_to_temp(a, value, size)
- != ARCHIVE_OK)
+ != ARCHIVE_OK) {
+ free(heap);
return (ARCHIVE_FATAL);
+ }
heap->length = size;
/* Add heap to the tail of file->xattr. */
heap->next = NULL;

0 comments on commit d873dd4

Please sign in to comment.