From: Eric Bollengier Date: Wed, 11 Nov 2009 14:58:57 +0000 (+0100) Subject: Replace POOL_MEM by POOLMEM to avoid segfaults X-Git-Tag: Release-7.0.0~2581 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=07518107344753d03ad157da1a50ec4af04b5d4e;p=bacula%2Fbacula Replace POOL_MEM by POOLMEM to avoid segfaults --- diff --git a/bacula/src/cats/sql_get.c b/bacula/src/cats/sql_get.c index 35ef7db9fe..0bcba5b91c 100644 --- a/bacula/src/cats/sql_get.c +++ b/bacula/src/cats/sql_get.c @@ -1224,9 +1224,10 @@ bool db_get_base_file_list(JCR *jcr, B_DB *mdb, bool db_get_base_jobid(JCR *jcr, B_DB *mdb, JOB_DBR *jr, JobId_t *jobid) { - POOL_MEM query(PM_FNAME); char date[MAX_TIME_LENGTH]; + bool ret=false; int64_t id = *jobid = 0; + POOLMEM *query = get_pool_memory(PM_FNAME); // char clientid[50], filesetid[50]; @@ -1250,17 +1251,18 @@ bool db_get_base_jobid(JCR *jcr, B_DB *mdb, JOB_DBR *jr, JobId_t *jobid) // edit_uint64(jr->FileSetId, filesetid)); date); - Dmsg1(10, "db_get_base_jobid q=%s\n", query.c_str()); - if (!db_sql_query(mdb, query.c_str(), db_int64_handler, &id)) { + Dmsg1(10, "db_get_base_jobid q=%s\n", query); + if (!db_sql_query(mdb, query, db_int64_handler, &id)) { goto bail_out; } *jobid = (JobId_t) id; Dmsg1(10, "db_get_base_jobid=%lld\n", id); - return true; + ret = true; bail_out: - return false; + free_pool_memory(query); + return ret; } #endif /* HAVE_SQLITE3 || HAVE_MYSQL || HAVE_SQLITE || HAVE_POSTGRESQL || HAVE_DBI */