]> git.sur5r.net Git - bacula/bacula/commitdiff
Fix buffer clobber when editing SQL error
authorKern Sibbald <kern@sibbald.com>
Mon, 2 Nov 2009 19:29:25 +0000 (20:29 +0100)
committerKern Sibbald <kern@sibbald.com>
Mon, 2 Nov 2009 19:29:25 +0000 (20:29 +0100)
bacula/src/cats/sql.c

index 49e9762010fb35ba1743c2396bf137613c67f740..5872fa3087de792082216bde2cc2a757880a903d 100644 (file)
@@ -761,9 +761,11 @@ bool db_open_batch_connexion(JCR *jcr, B_DB *mdb)
       }
 
       if (!db_open_database(jcr, jcr->db_batch)) {
-         Mmsg2(&jcr->db_batch->errmsg,  _("Could not open database \"%s\": ERR=%s\n"),
+         POOLMEM *errmsg = get_pool_memory(PM_MESSAGE);
+         Mmsg2(&errmsg,  _("Could not open database \"%s\": ERR=%s\n"),
               jcr->db_batch->db_name, db_strerror(jcr->db_batch));
-         Jmsg1(jcr, M_FATAL, 0, "%s", jcr->db_batch->errmsg);
+         Jmsg1(jcr, M_FATAL, 0, "%s", errmsg);
+         free_pool_memory(errmsg);
          return false;
       }      
       Dmsg3(100, "initdb ref=%d connected=%d db=%p\n", jcr->db_batch->ref_count,