From: Eric Bollengier Date: Wed, 23 Mar 2022 10:07:38 +0000 (+0100) Subject: cdp: Fix small memory leak after an error X-Git-Tag: Beta-15.0.0~617 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=46582f9786bcd5af4c96d45143978473ff0103a7;p=thirdparty%2Fbacula.git cdp: Fix small memory leak after an error --- diff --git a/bacula/src/tools/cdp-client/backupservice.cpp b/bacula/src/tools/cdp-client/backupservice.cpp index b910cc105..d2a28e57e 100644 --- a/bacula/src/tools/cdp-client/backupservice.cpp +++ b/bacula/src/tools/cdp-client/backupservice.cpp @@ -38,7 +38,8 @@ void BackupService::start(const char *spoolPath, Journal *j) err_msg = w->watch(rec->path); if (err_msg != NULL) { - Dmsg2(0, "Error while trying to watch %s. %s", rec->path, err_msg); + Dmsg2(0, "Error while trying to watch %s. %s", rec->path, err_msg); + free_and_null_pool_memory(err_msg); } else { _watchers[rec->path] = w; } @@ -63,7 +64,7 @@ POOLMEM *BackupService::watch(const char *folder) _journal->writeFolderRecord(rec); _watchers[rec.path] = w; } else { - Dmsg2(0, "Error while trying to watch %s. %s", fpath, err_msg); + Dmsg2(0, "Error while trying to watch %s. %s", fpath, err_msg); delete w; }