From: Mike Stepanek (mstepane) Date: Thu, 24 Feb 2022 11:35:22 +0000 (+0000) Subject: Pull request #3287: Check for null pointer. X-Git-Tag: 3.1.25.0~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=905f0456dce38734120619233f654739b584ec66;p=thirdparty%2Fsnort3.git Pull request #3287: Check for null pointer. Merge in SNORT/snort3 from ~OSHUMEIK/snort3:nullptr_check to master Squashed commit of the following: commit 56fd2e82203634e775a3aea7c31f8643a7256665 Author: Oleksii Shumeiko Date: Wed Feb 23 12:46:28 2022 +0200 utils: check for NULL before calling fclose() --- diff --git a/src/utils/util.cc b/src/utils/util.cc index e60d62a51..6694e037f 100644 --- a/src/utils/util.cc +++ b/src/utils/util.cc @@ -207,7 +207,11 @@ void CreatePidFile(pid_t pid) } else { - fclose(pid_lockfile); + if (pid_lockfile) + { + fclose(pid_lockfile); + pid_lockfile = nullptr; + } const char* error = get_error(errno); ErrorMessage("Failed to create pid file %s, Error: %s\n", sc->pid_filename.c_str(), error);