diff options
author | Nick Mathewson <nickm@torproject.org> | 2019-10-18 12:25:55 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2019-10-18 12:25:55 -0400 |
commit | fbd2fef22014ec5ca553e35147a1b1f0b60cc612 (patch) | |
tree | 8e42a62c9ee0f345ca56ed075793789313797415 /src | |
parent | eebd2d44a1f45366f372a0ece2a851912607e0a2 (diff) | |
parent | f73c8bd7865a8a64d46c126ca7e206204510ace8 (diff) | |
download | tor-fbd2fef22014ec5ca553e35147a1b1f0b60cc612.tar.gz tor-fbd2fef22014ec5ca553e35147a1b1f0b60cc612.zip |
Merge branch 'maint-0.4.2' of git-rw.torproject.org:/tor into maint-0.4.2
Diffstat (limited to 'src')
-rw-r--r-- | src/feature/hs/hs_cell.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/feature/hs/hs_cell.c b/src/feature/hs/hs_cell.c index d691a1b007..df59f73c1b 100644 --- a/src/feature/hs/hs_cell.c +++ b/src/feature/hs/hs_cell.c @@ -503,8 +503,8 @@ build_establish_intro_dos_extension(const hs_service_config_t *service_config, ssize_t ret; size_t dos_ext_encoded_len; uint8_t *field_array; - trn_cell_extension_field_t *field; - trn_cell_extension_dos_t *dos_ext; + trn_cell_extension_field_t *field = NULL; + trn_cell_extension_dos_t *dos_ext = NULL; tor_assert(service_config); tor_assert(extensions); @@ -530,7 +530,7 @@ build_establish_intro_dos_extension(const hs_service_config_t *service_config, /* Set the field with the encoded DoS extension. */ ret = trn_cell_extension_dos_encoded_len(dos_ext); if (BUG(ret <= 0)) { - return -1; + goto err; } dos_ext_encoded_len = ret; /* Set length field and the field array size length. */ @@ -541,7 +541,7 @@ build_establish_intro_dos_extension(const hs_service_config_t *service_config, ret = trn_cell_extension_dos_encode(field_array, trn_cell_extension_field_getlen_field(field), dos_ext); if (BUG(ret <= 0)) { - return -1; + goto err; } tor_assert(ret == (ssize_t) dos_ext_encoded_len); @@ -557,6 +557,11 @@ build_establish_intro_dos_extension(const hs_service_config_t *service_config, trn_cell_extension_dos_free(dos_ext); return 0; + + err: + trn_cell_extension_field_free(field); + trn_cell_extension_dos_free(dos_ext); + return -1; } /* ========== */ |