mirror of
https://github.com/kernelkit/infix.git
synced 2026-07-24 01:43:00 +02:00
confd: fix double free of container hostname
Fix a double free in the memory minefield surrounding container hostname provisioning. The hostnamefmt() function already does free() on success. This caused all sorts of mayhem when working with multiple containers. However it mainly manifested itself by some containers not starting due to there activation script being polluted with gibberish name data. Your symptom might be different.. Example of polluted activation script: container --hostname foobar --net veth0k -r always \ create ^S@`M-}^G docker://ghcr.io/kernelkit/curios:edge Signed-off-by: Richard Alpe <richard@bit42.se>
This commit is contained in:
@@ -52,12 +52,10 @@ static int add(const char *name, struct lyd_node *cif)
|
||||
if ((string = lydx_get_cattr(cif, "hostname"))) {
|
||||
char *fmt = (char *)string;
|
||||
|
||||
if (hostnamefmt(&confd, &fmt)) {
|
||||
if (hostnamefmt(&confd, &fmt))
|
||||
ERRNO("%s: failed setting custom hostname", name);
|
||||
} else {
|
||||
else
|
||||
fprintf(fp, " --hostname %s", fmt);
|
||||
free(fmt);
|
||||
}
|
||||
}
|
||||
|
||||
if (lydx_is_enabled(cif, "read-only"))
|
||||
|
||||
Reference in New Issue
Block a user