Make io_buffer_t::create return a shared_ptr

Eliminates some manual memory management
This commit is contained in:
ridiculousfish
2017-01-22 00:44:04 -08:00
parent 009a677e0d
commit 6bdab62358
3 changed files with 6 additions and 7 deletions

View File

@@ -642,7 +642,7 @@ void exec_job(parser_t &parser, job_t *j) {
if (p->next) {
// Be careful to handle failure, e.g. too many open fds.
block_output_io_buffer.reset(io_buffer_t::create(STDOUT_FILENO, all_ios));
block_output_io_buffer = io_buffer_t::create(STDOUT_FILENO, all_ios);
if (block_output_io_buffer.get() == NULL) {
exec_error = true;
job_mark_process_as_failed(j, p);
@@ -668,7 +668,7 @@ void exec_job(parser_t &parser, job_t *j) {
case INTERNAL_BLOCK_NODE: {
if (p->next) {
block_output_io_buffer.reset(io_buffer_t::create(STDOUT_FILENO, all_ios));
block_output_io_buffer = io_buffer_t::create(STDOUT_FILENO, all_ios);
if (block_output_io_buffer.get() == NULL) {
// We failed (e.g. no more fds could be created).
exec_error = true;