]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
cdp: Fix small memory leak after an error
authorEric Bollengier <eric@baculasystems.com>
Wed, 23 Mar 2022 10:07:38 +0000 (11:07 +0100)
committerEric Bollengier <eric@baculasystems.com>
Thu, 14 Sep 2023 11:56:58 +0000 (13:56 +0200)
bacula/src/tools/cdp-client/backupservice.cpp

index b910cc1054ca9cf7415978e4bcc06309f7067f9c..d2a28e57e04305fa79bc34309b6ecc91886e952a 100644 (file)
@@ -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;
     }