summaryrefslogtreecommitdiff
path: root/pppd/main.c
diff options
context:
space:
mode:
authorAlfonso Sánchez-Beato <alfonso.sanchez-beato@canonical.com>2019-06-06 17:36:29 +0200
committerPaul Mackerras <paulus@ozlabs.org>2019-10-19 15:52:21 +1100
commitb6b4d28e0c38320ca6753af40845df991118cd11 (patch)
treed0ce7ff5457a49e90f2d50f7df463bebfa8b6e80 /pppd/main.c
parent0d004db25edd42f6720f48eedc51f68a781278db (diff)
downloadppp-b6b4d28e0c38320ca6753af40845df991118cd11.tar.gz
pppd: Check tdb pointer before closing
Check that pointer to the tdb is not NULL before calling tdb_close(). It is possible that the file could not be opened/created due to permission issues. This change prevents the crash that happens in that case. Signed-off-by: Alfonso Sánchez-Beato <alfonso.sanchez-beato@canonical.com>
Diffstat (limited to 'pppd/main.c')
-rw-r--r--pppd/main.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/pppd/main.c b/pppd/main.c
index 41be532..1b3f1e5 100644
--- a/pppd/main.c
+++ b/pppd/main.c
@@ -1574,7 +1574,8 @@ safe_fork(int infd, int outfd, int errfd)
/* Executing in the child */
sys_close();
#ifdef USE_TDB
- tdb_close(pppdb);
+ if (pppdb != NULL)
+ tdb_close(pppdb);
#endif
/* make sure infd, outfd and errfd won't get tromped on below */