]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
Fix #7286 DIR segfault when doing a "dir" command in a restore
authorAlain Spineux <alain@baculasystems.com>
Wed, 3 Mar 2021 10:54:16 +0000 (11:54 +0100)
committerEric Bollengier <eric@baculasystems.com>
Thu, 24 Mar 2022 08:03:00 +0000 (09:03 +0100)
- this initialize "ua->jcr->db" as it is done few lines below at the first
  initialization
- the ticket shows that ua->db was used successfully by other functions
  few line before the crash while ua->jcr->db == NULL.
- it could be a fix (I cannot shows that)
- it could be a new bug (I don't see how)
- it is probably an improvement as the first and the next calls will
  return a consistent "ua"

bacula/src/dird/ua_cmds.c

index 28a3b5d9999fe76b1cc276348ab0a886826bcad1..1d54c8f2547984f28567f0853197179bf1eccbaf 100644 (file)
@@ -3212,10 +3212,10 @@ bool open_db(UAContext *ua)
     * private or the shared link
     */
    if (ua->force_mult_db_connections) {
-      ua->db = ua->private_db;
+      ua->jcr->db = ua->db = ua->private_db;
 
    } else {
-      ua->db = ua->shared_db;
+      ua->jcr->db = ua->db = ua->shared_db;
    }
 
    if (ua->db) {