Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions source/process_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ int aws_run_command(
AWS_FATAL_ASSERT(options);
AWS_FATAL_ASSERT(result);

FILE *output_stream;
FILE *output_stream = NULL;
char output_buffer[MAX_BUFFER_SIZE];
struct aws_byte_buf result_buffer;
int ret = AWS_OP_ERR;
Expand All @@ -71,11 +71,6 @@ int aws_run_command(
}
}
}
# if defined(AWS_OS_WINDOWS)
result->ret_code = _pclose(output_stream);
# else
result->ret_code = pclose(output_stream);
# endif
}

struct aws_byte_cursor trim_cursor = aws_byte_cursor_from_buf(&result_buffer);
Expand All @@ -89,6 +84,13 @@ int aws_run_command(
ret = AWS_OP_SUCCESS;

on_finish:
if (output_stream) {
# if defined(AWS_OS_WINDOWS)
_pclose(output_stream);
# else
pclose(output_stream);
# endif
}
aws_byte_buf_clean_up_secure(&result_buffer);
return ret;
}
Expand Down