]> git.sur5r.net Git - bacula/bacula/commitdiff
Use POOLMEM and get_memory instead of alloca in src/dird/status.c and src/stored...
authorNicolas Boichat <nicolas@boichat.ch>
Thu, 26 Aug 2004 23:10:41 +0000 (23:10 +0000)
committerNicolas Boichat <nicolas@boichat.ch>
Thu, 26 Aug 2004 23:10:41 +0000 (23:10 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1560 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/src/filed/status.c
bacula/src/stored/status.c

index 0e02b3538831947232a47b12f1e4fda64e820f06..0d28b9c43a4efe28f0d50729cefa4364910b1b6f 100755 (executable)
@@ -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;
 }
 
index d9b4f05028dd98b5d229bf5fb10d34a02bcd6ac3..14f99b2639f957e286f7cd2e603d505267bad410 100644 (file)
@@ -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;
 }