]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/wx-console/console_conf.c
kes Simplify locking in the reservations system.
[bacula/bacula] / bacula / src / wx-console / console_conf.c
index 82bb8842d8cd90a9da8c30b2c278de44e320212c..976794b2315a4b8e8fa879951e561accc56627f9 100644 (file)
@@ -320,15 +320,16 @@ void save_resource(int type, RES_ITEM *items, int pass)
       if (!res_head[rindex]) {
          res_head[rindex] = (RES *)res; /* store first entry */
       } else {
-         RES *next;
-         for (next=res_head[rindex]; next->next; next=next->next) {
+         RES *next, *last;
+         for (last=next=res_head[rindex]; next; next=next->next) {
+            last = next;
             if (strcmp(next->name, res->res_dir.hdr.name) == 0) {
                Emsg2(M_ERROR_TERM, 0,
                    wxString(_("Attempt to define second %s resource named \"%s\" is not permitted.\n")).mb_str(*wxConvCurrent),
                    resources[rindex].name, res->res_dir.hdr.name);
             }
          }
-         next->next = (RES *)res;
+         last->next = (RES *)res;
             Dmsg2(90, "Inserting %s res: %s\n", res_to_str(type),
                   res->res_dir.hdr.name);
       }