]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/urn.cc
Source Format Enforcement (#532)
[thirdparty/squid.git] / src / urn.cc
index efadc88151239793212aa5dc121135083ba2d83a..cd794bdfca8ea5667293b4274f9c89835800f8aa 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1996-2019 The Squid Software Foundation and contributors
+ * Copyright (C) 1996-2020 The Squid Software Foundation and contributors
  *
  * Squid software is distributed under GPLv2+ license and includes
  * contributions from numerous individuals and organizations.
@@ -11,6 +11,7 @@
 #include "squid.h"
 #include "AccessLogEntry.h"
 #include "acl/FilledChecklist.h"
+#include "base/TextException.h"
 #include "cbdata.h"
 #include "errorpage.h"
 #include "FwdState.h"
@@ -78,16 +79,18 @@ CBDATA_CLASS_INIT(UrnState);
 
 UrnState::~UrnState()
 {
-    if (urlres_e) {
-        if (sc)
-            storeUnregister(sc, urlres_e, this);
-        urlres_e->unlock("~UrnState+res");
-    }
+    SWALLOW_EXCEPTIONS({
+        if (urlres_e) {
+            if (sc)
+                storeUnregister(sc, urlres_e, this);
+            urlres_e->unlock("~UrnState+res");
+        }
 
-    if (entry)
-        entry->unlock("~UrnState+prime");
+        if (entry)
+            entry->unlock("~UrnState+prime");
 
-    safe_free(urlres);
+        safe_free(urlres);
+    });
 }
 
 static url_entry *
@@ -290,7 +293,7 @@ urnHandleReply(void *data, StoreIOBuffer result)
     }
 
     s = buf + k;
-    assert(urlres_e->getReply());
+    // TODO: Check whether we should parse urlres_e reply, as before 528b2c61.
     rep = new HttpReply;
     rep->parseCharBuf(buf, k);
     debugs(52, 3, "reply exists, code=" << rep->sline.status() << ".");