From: Alfonso Sánchez-Beato Date: Thu, 6 Jun 2019 15:36:29 +0000 (+0200) Subject: pppd: Check tdb pointer before closing X-Git-Tag: ppp-2.4.8~14 X-Git-Url: http://git.ozlabs.org/?a=commitdiff_plain;h=b6b4d28e0c38320ca6753af40845df991118cd11;p=ppp.git 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 --- 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 */