Is it against the C standard for an implementation to collect garbage allocated using malloc?

About
including Ellenor, Reinhilde, Amelia, Melanie, Andrea, Sarah, and Lightning
Administrative account for this instance.
25, tired, extremely white, plausibly anti-vegan, transfem system, bi lesbian, proprietor Umbrellix. Only speaks English. Account NOT a safe space for COVID minimizers and pro-infectionists.
We will not usually reblog images without alt text.
DNF/DNI if you're team KYLR.
Until The Last.
Recent posts
Wiktionary is daft
I wonder if there's a static analysis tool that can tell me where free() is being called without an explicit malloc()
Oh no, somebody installed ransomware on my soul.
why isn't RAM copy-on-write
Part of me wants to patch Xorg to use the Boehm garbage collector for all malloc calls.
hey guys what'd break if i recompiled Xorg with Boehm?
I wonder: what if Xorg, but chrooted.
I wonder what'd break if I recompiled X11 with the Boehm GC
Code; long; code question
(patching /usr/src/usr.bin/indent/indent.c on a HardenedBSD fork)
Hey, does this look robust to you?
static void bakcopy(void)
{
int n, bakchn, renamesuccess;
char buff[8 * 1024];
const char *p;
/* construct file name .Bfile */
for (p = in_name; *p; p++); /* skip to end of string */
while (p > in_name && *p != '/') /* find last '/' */
p--;
if (*p == '/')
p++;
sprintf(bakfile, "%s%s", p, simple_backup_suffix);
/* try first: move in_name to backup file; if that fails (and how?) then copy. */
if ((renamesuccess = rename(in_name, bakfile)) != 0) {
warn("could not make backup (%s -> %s) by moving; copying instead", in_name, bakfile);
/* copy in_name to backup file */
bakchn = creat(bakfile, 0600);
if (bakchn < 0)
err(1, "%s", bakfile);
while ((n = read(fileno(input), buff, sizeof(buff))) > 0)
if (write(bakchn, buff, n) != n)
err(1, "%s", bakfile);
if (n < 0)
err(1, "%s", in_name);
close(bakchn);
fclose(input);
/* re-open backup file as the input file */
input = fopen(bakfile, "r");
if (input == NULL)
err(1, "%s", bakfile);
}
/* now the original input file will be the output */
output = fopen(in_name, "w");
if (output == NULL) {
/* only if renamesuccess is -1 would we be able to unlink the backup without losing the file. */
if (renamesuccess == -1) {
unlink(bakfile);
err(1, "%s", in_name);
} else {
warn("fatal - unable to open %s", in_name);
if (rename(bakfile, in_name) == -1) err(1, "... and unable to rename backup file %s", bakfile);
exit(1); /* NOTREACHED unless rename succeeds */
}
}
}