daemon: fix memory leak in do_aug_match on realloc failure (#313)

When realloc fails, vp is NULL so free(vp) is a no-op. The original
matches array (and all r strings allocated by aug_match) is leaked.
Use free_stringslen to properly free the array and its contents.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
shivanayak
2026-03-09 22:16:00 +05:30
committed by GitHub
parent 9b890de878
commit cb233a73c6

View File

@@ -342,7 +342,7 @@ do_aug_match (const char *path)
vp = realloc (matches, sizeof (char *) * (r+1));
if (vp == NULL) {
reply_with_perror ("realloc");
free (vp);
free_stringslen (matches, r);
return NULL;
}
matches = vp;