summaryrefslogtreecommitdiff
path: root/src/or/hs_service.c
diff options
context:
space:
mode:
authorGeorge Kadianakis <desnacked@riseup.net>2017-08-25 16:13:19 +0300
committerGeorge Kadianakis <desnacked@riseup.net>2017-08-25 17:18:05 +0300
commit409ecbec521ea4b5eef8605f71f4f7b768087486 (patch)
treeb56eab47100e0ee9ee6df386ec8147d1804cd7e6 /src/or/hs_service.c
parent17fd2c8a51900bd71eaeff397ec64b6949a51730 (diff)
downloadtor-409ecbec521ea4b5eef8605f71f4f7b768087486.tar.gz
tor-409ecbec521ea4b5eef8605f71f4f7b768087486.zip
prop224: Be more careful to not overwrite descriptors in HUP.
Diffstat (limited to 'src/or/hs_service.c')
-rw-r--r--src/or/hs_service.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/or/hs_service.c b/src/or/hs_service.c
index 12410588b5..80078e203f 100644
--- a/src/or/hs_service.c
+++ b/src/or/hs_service.c
@@ -964,7 +964,8 @@ service_descriptor_new(void)
return sdesc;
}
-/* Move descriptor(s) from the src service to the dst service. */
+/* Move descriptor(s) from the src service to the dst service. We do this
+ * during SIGHUP when we re-create our hidden services. */
static void
move_descriptors(hs_service_t *src, hs_service_t *dst)
{
@@ -972,10 +973,19 @@ move_descriptors(hs_service_t *src, hs_service_t *dst)
tor_assert(dst);
if (src->desc_current) {
+ /* Nothing should be there, but clean it up just in case */
+ if (BUG(dst->desc_current)) {
+ service_descriptor_free(dst->desc_current);
+ }
dst->desc_current = src->desc_current;
src->desc_current = NULL;
}
+
if (src->desc_next) {
+ /* Nothing should be there, but clean it up just in case */
+ if (BUG(dst->desc_next)) {
+ service_descriptor_free(dst->desc_next);
+ }
dst->desc_next = src->desc_next;
src->desc_next = NULL;
}