]> git.ipfire.org Git - thirdparty/samba.git/commit
lib: Refactor fgets usage, fix resource leaks
authorShwetha K Acharya <Shwetha.K.Acharya@ibm.com>
Tue, 20 May 2025 07:59:59 +0000 (13:29 +0530)
committerVolker Lendecke <vl@samba.org>
Fri, 13 Jun 2025 16:46:33 +0000 (16:46 +0000)
commit08d3de949aff6405323c07e8b7859f3d1d4d2122
tree9054bb65079b8d1442ce2404789a76ce54e7d500
parent686a39a2b04bbd0172960152cb09b9ce9e5c8e9f
lib: Refactor fgets usage, fix resource leaks

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
lib/texpect/texpect.c