summaryrefslogtreecommitdiff
path: root/libarchive/archive_read_support_filter_program.c
diff options
context:
space:
mode:
authorMichihiro NAKAJIMA <ggcueroad@gmail.com>2012-10-08 06:21:49 +0900
committerMichihiro NAKAJIMA <ggcueroad@gmail.com>2012-10-08 11:48:39 +0900
commit0eca73efb98da4c0afee1dec010e007108ab3ee5 (patch)
treef442680b506ad6ef60a9e5a5af79fe0d2ebff85b /libarchive/archive_read_support_filter_program.c
parent664ea71debc6d0528f45da11ee0f1c937242aa83 (diff)
downloadlibarchive-0eca73efb98da4c0afee1dec010e007108ab3ee5.tar.gz
Fix potential memory leaks found with Clang.
Diffstat (limited to 'libarchive/archive_read_support_filter_program.c')
-rw-r--r--libarchive/archive_read_support_filter_program.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libarchive/archive_read_support_filter_program.c b/libarchive/archive_read_support_filter_program.c
index 5b052d7c..344f5a98 100644
--- a/libarchive/archive_read_support_filter_program.c
+++ b/libarchive/archive_read_support_filter_program.c
@@ -650,8 +650,10 @@ __archive_read_programv(struct archive_read_filter *self, const char *cmd,
archive_string_ensure(&state->description, l) == NULL) {
archive_set_error(&self->archive->archive, ENOMEM,
"Can't allocate input data");
- archive_string_free(&state->description);
- free(state);
+ if (state != NULL) {
+ archive_string_free(&state->description);
+ free(state);
+ }
free(out_buf);
return (ARCHIVE_FATAL);
}