From 380690412c2a367f04d7e905479ed623c0281b04 Mon Sep 17 00:00:00 2001 From: Nicolas Boichat Date: Thu, 26 Aug 2004 23:10:41 +0000 Subject: [PATCH] Use POOLMEM and get_memory instead of alloca in src/dird/status.c and src/stored/status.c. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1560 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/filed/status.c | 7 +++++-- bacula/src/stored/status.c | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/bacula/src/filed/status.c b/bacula/src/filed/status.c index 0e02b35388..0d28b9c43a 100755 --- a/bacula/src/filed/status.c +++ b/bacula/src/filed/status.c @@ -278,17 +278,18 @@ int status_cmd(JCR *jcr) int qstatus_cmd(JCR *jcr) { BSOCK *dir = jcr->dir_bsock; - char *time; + POOLMEM *time; JCR *njcr; s_last_job* job; - time = (char *) alloca(dir->msglen+1); + time = get_memory(dir->msglen+1); if (sscanf(dir->msg, qstatus, time) != 1) { pm_strcpy(&jcr->errmsg, dir->msg); Jmsg1(jcr, M_FATAL, 0, _("Bad .status command: %s\n"), jcr->errmsg); bnet_fsend(dir, "2900 Bad .status command, missing argument.\n"); bnet_sig(dir, BNET_EOD); + free_memory(time); return 0; } unbash_spaces(time); @@ -316,10 +317,12 @@ int qstatus_cmd(JCR *jcr) Jmsg1(jcr, M_FATAL, 0, _("Bad .status command: %s\n"), jcr->errmsg); bnet_fsend(dir, "2900 Bad .status command, wrong argument.\n"); bnet_sig(dir, BNET_EOD); + free_memory(time); return 0; } bnet_sig(dir, BNET_EOD); + free_memory(time); return 1; } diff --git a/bacula/src/stored/status.c b/bacula/src/stored/status.c index d9b4f05028..14f99b2639 100644 --- a/bacula/src/stored/status.c +++ b/bacula/src/stored/status.c @@ -425,17 +425,18 @@ static void sendit(const char *msg, int len, void *arg) int qstatus_cmd(JCR *jcr) { BSOCK *dir = jcr->dir_bsock; - char *time; + POOLMEM *time; JCR *njcr; s_last_job* job; - time = (char *) alloca(dir->msglen+1); + time = get_memory(dir->msglen+1); if (sscanf(dir->msg, qstatus, time) != 1) { pm_strcpy(&jcr->errmsg, dir->msg); Jmsg1(jcr, M_FATAL, 0, _("Bad .status command: %s\n"), jcr->errmsg); bnet_fsend(dir, "3900 Bad .status command, missing argument.\n"); bnet_sig(dir, BNET_EOD); + free_memory(time); return 0; } unbash_spaces(time); @@ -463,9 +464,11 @@ int qstatus_cmd(JCR *jcr) Jmsg1(jcr, M_FATAL, 0, _("Bad .status command: %s\n"), jcr->errmsg); bnet_fsend(dir, "3900 Bad .status command, wrong argument.\n"); bnet_sig(dir, BNET_EOD); + free_memory(time); return 0; } bnet_sig(dir, BNET_EOD); + free_memory(time); return 1; } -- 2.39.2