The dsnparseaddr() function has three resource leaks:
1. The file handle 'f' is never closed after parsing the DSN mail
2. The 'boundary' string is allocated but never freed
3. The 'emails' list is populated but never freed on exit
Free all three resources before all return paths.
Fixes: a1f1fbc8 ("mlmmj-bounce: make sure mlmmj-bounce is never called directly")
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
break;
}
/* this is not a miltipart/report mail see RFC1839 */
- if (boundary == NULL)
+ if (boundary == NULL) {
+ fclose(f);
return NULL;
+ }
while ((getline(&buf, &bufcap, f) > 0)) {
chomp(buf);
if (indsn) {
}
}
free(buf);
+ free(boundary);
+ fclose(f);
+ tll_free_and_free(emails, free);
return addr;
}