From a64262697afb85f8db5872238c51b9499114ee58 Mon Sep 17 00:00:00 2001 From: Matthias Dieter Wallnöfer Date: Thu, 27 May 2010 17:37:15 +0200 Subject: s4:smbd/pidfile.c - fix "asprintf" calls --- source4/smbd/pidfile.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'source4') diff --git a/source4/smbd/pidfile.c b/source4/smbd/pidfile.c index da3f363ff9..de93a0390c 100644 --- a/source4/smbd/pidfile.c +++ b/source4/smbd/pidfile.c @@ -38,7 +38,9 @@ pid_t pidfile_pid(const char *piddir, const char *name) pid_t ret; char *pidFile; - asprintf(&pidFile, "%s/%s.pid", piddir, name); + if (asprintf(&pidFile, "%s/%s.pid", piddir, name) < 0) { + return 0; + } fd = open(pidFile, O_NONBLOCK | O_RDONLY, 0644); @@ -85,7 +87,10 @@ void pidfile_create(const char *piddir, const char *name) char *pidFile; pid_t pid; - asprintf(&pidFile, "%s/%s.pid", piddir, name); + if (asprintf(&pidFile, "%s/%s.pid", piddir, name) < 0) { + DEBUG(0,("ERROR: Out of memory\n")); + exit(1); + } pid = pidfile_pid(piddir, name); if (pid != 0) { -- cgit