Skip to content

Commit

Permalink
cats: fix memory issues in catalog-test
Browse files Browse the repository at this point in the history
  • Loading branch information
arogge committed Feb 24, 2022
1 parent 1c83b9a commit ff53655
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions core/src/cats/sql_find.cc
Expand Up @@ -3,7 +3,7 @@
Copyright (C) 2000-2012 Free Software Foundation Europe e.V.
Copyright (C) 2011-2016 Planets Communications B.V.
Copyright (C) 2013-2019 Bareos GmbH & Co. KG
Copyright (C) 2013-2022 Bareos GmbH & Co. KG
This program is Free Software; you can redistribute it and/or
modify it under the terms of version three of the GNU Affero General Public
Expand Down Expand Up @@ -157,7 +157,7 @@ BareosDb::SqlFindResult BareosDb::FindLastJobStartTimeForJobAndClient(
client_name.size());

constexpr const char* default_time{"0000-00-00 00:00:00"};
stime_out.resize(strlen(default_time));
stime_out.resize(strlen(default_time) + 1);
strcpy(stime_out.data(), default_time);

Mmsg(cmd,
Expand Down
3 changes: 1 addition & 2 deletions core/src/tests/catalog.cc
Expand Up @@ -119,6 +119,7 @@ void CatalogTest::SetUp()

void CatalogTest::TearDown()
{
db->CloseDatabase(jcr);
DbSqlPoolDestroy();
DbFlushBackends();

Expand All @@ -136,8 +137,6 @@ void CatalogTest::TearDown()
TEST_F(CatalogTest, database)
{
std::vector<char> stime;
auto jcr = directordaemon::NewDirectorJcr();

auto result = db->FindLastJobStartTimeForJobAndClient(jcr, "backup-bareos-fd",
"bareos-fd", stime);

Expand Down

0 comments on commit ff53655

Please sign in to comment.