nspawn: fix memleak uncovered by fuzzer
Also use TAKE_PTR as appropriate.
This commit is contained in:
@@ -206,7 +206,7 @@ int bind_mount_parse(CustomMount **l, size_t *n, const char *s, bool read_only)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isempty(source))
|
if (isempty(source))
|
||||||
source = NULL;
|
source = mfree(source);
|
||||||
else if (!source_path_is_valid(source))
|
else if (!source_path_is_valid(source))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
@@ -219,12 +219,10 @@ int bind_mount_parse(CustomMount **l, size_t *n, const char *s, bool read_only)
|
|||||||
if (!m)
|
if (!m)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
m->source = source;
|
m->source = TAKE_PTR(source);
|
||||||
m->destination = destination;
|
m->destination = TAKE_PTR(destination);
|
||||||
m->read_only = read_only;
|
m->read_only = read_only;
|
||||||
m->options = opts;
|
m->options = TAKE_PTR(opts);
|
||||||
|
|
||||||
source = destination = opts = NULL;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user