This commit refactors the code by replacing fgets with
getline for more reliable line reading.
Additionally this PR,
- Corrects the error message for calloc failure.
- Ensures that resources are properly freed and
closed before calling errx(), fixing potential
resource leaks.
- Adds a check to gracefully skip newlines and
comment lines(starting with #)
- simplifies error handling by grouping repetitive
free statements under goto block
Signed-off-by: Shwetha K Acharya <Shwetha.K.Acharya@ibm.com> Reviewed-by: Anoop C S <anoopcs@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Fri Jun 13 16:46:33 UTC 2025 on atb-devel-224