aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2008-01-23 00:21:04 +0200
committerLasse Collin <lasse.collin@tukaani.org>2008-01-23 00:21:04 +0200
commit67321de963ccf69410b3868b8e31534fe18a90de (patch)
tree6ee045b00a18ccc85a7e95e5a86587bb3389c2f0
parentFixed a dangling pointer that caused invalid free(). (diff)
downloadxz-67321de963ccf69410b3868b8e31534fe18a90de.tar.xz
Take advantage of return_if_error() macro in
lzma_info_metadata_set() in info.c.
-rw-r--r--src/liblzma/common/info.c24
1 files changed, 8 insertions, 16 deletions
diff --git a/src/liblzma/common/info.c b/src/liblzma/common/info.c
index cbd32d6b..aee25463 100644
--- a/src/liblzma/common/info.c
+++ b/src/liblzma/common/info.c
@@ -406,28 +406,20 @@ lzma_info_metadata_set(lzma_info *info, lzma_allocator *allocator,
const lzma_vli size = metadata->header_metadata_size
!= LZMA_VLI_VALUE_UNKNOWN
? metadata->header_metadata_size : 0;
- const lzma_ret ret = lzma_info_size_set(
- info, LZMA_INFO_HEADER_METADATA, size);
- if (ret != LZMA_OK)
- return ret;
+ return_if_error(lzma_info_size_set(
+ info, LZMA_INFO_HEADER_METADATA, size));
}
// Total Size
- if (metadata->total_size != LZMA_VLI_VALUE_UNKNOWN) {
- const lzma_ret ret = lzma_info_size_set(info,
- LZMA_INFO_TOTAL, metadata->total_size);
- if (ret != LZMA_OK)
- return ret;
- }
+ if (metadata->total_size != LZMA_VLI_VALUE_UNKNOWN)
+ return_if_error(lzma_info_size_set(info,
+ LZMA_INFO_TOTAL, metadata->total_size));
// Uncompressed Size
- if (metadata->uncompressed_size != LZMA_VLI_VALUE_UNKNOWN) {
- const lzma_ret ret = lzma_info_size_set(info,
+ if (metadata->uncompressed_size != LZMA_VLI_VALUE_UNKNOWN)
+ return_if_error(lzma_info_size_set(info,
LZMA_INFO_UNCOMPRESSED,
- metadata->uncompressed_size);
- if (ret != LZMA_OK)
- return ret;
- }
+ metadata->uncompressed_size));
return LZMA_OK;
}