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: 14 additions & 0 deletions bubblewrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ struct _SetupOp
SetupOpFlag flags;
int perms;
size_t size; /* number of bytes, zero means unset/default */
bool source_owned;
SetupOp *next;
};

Expand Down Expand Up @@ -1375,6 +1376,13 @@ close_ops_fd (void)
(void) close (op->fd);
op->fd = -1;
}

if (op->source_owned)
{
free ((char *) op->source);
op->source = NULL;
op->source_owned = false;
}
}
}

Expand Down Expand Up @@ -1407,6 +1415,11 @@ resolve_symlinks_in_ops (void)
else
die_with_error("Can't find source path %s", old_source);
}
else if (op->source_owned)
{
free ((char *) old_source);
}
op->source_owned = false;
break;

case SETUP_RO_OVERLAY_MOUNT:
Expand Down Expand Up @@ -1734,6 +1747,7 @@ parse_args_recurse (int *argcp,
else
op = setup_op_new (SETUP_BIND_MOUNT);
op->source = xasprintf ("/proc/self/fd/%d", src_fd);
op->source_owned = true;
op->fd = src_fd;
op->dest = argv[2];

Expand Down