diff --git a/src/XrdMacaroons/XrdMacaroonsHandler.cc b/src/XrdMacaroons/XrdMacaroonsHandler.cc index dab3c62336a..e6d02e18671 100644 --- a/src/XrdMacaroons/XrdMacaroonsHandler.cc +++ b/src/XrdMacaroons/XrdMacaroonsHandler.cc @@ -568,8 +568,7 @@ Handler::GenerateMacaroonResponse(XrdHttpExtReq &req, const std::string &resourc size_t size_hint = macaroon_serialize_size_hint(mac_with_date); - std::vector macaroon_resp; macaroon_resp.reserve(size_hint); - macaroon_resp.push_back((char)0); + std::vector macaroon_resp; macaroon_resp.resize(size_hint); if (macaroon_serialize(mac_with_date, &macaroon_resp[0], size_hint, &mac_err)) { printf("Returned macaroon_serialize code: %lu\n", (unsigned long)size_hint); diff --git a/src/XrdThrottle/XrdThrottleManager.cc b/src/XrdThrottle/XrdThrottleManager.cc index ad255f88a8d..8bea2374582 100644 --- a/src/XrdThrottle/XrdThrottleManager.cc +++ b/src/XrdThrottle/XrdThrottleManager.cc @@ -48,10 +48,10 @@ XrdThrottleManager::Init() { TRACE(DEBUG, "Initializing the throttle manager."); // Initialize all our shares to zero. - m_primary_bytes_shares.reserve(m_max_users); - m_secondary_bytes_shares.reserve(m_max_users); - m_primary_ops_shares.reserve(m_max_users); - m_secondary_ops_shares.reserve(m_max_users); + m_primary_bytes_shares.resize(m_max_users); + m_secondary_bytes_shares.resize(m_max_users); + m_primary_ops_shares.resize(m_max_users); + m_secondary_ops_shares.resize(m_max_users); // Allocate each user 100KB and 10 ops to bootstrap; for (int i=0; i 0) { - m_buffer.reserve(m_capacity); + m_buffer.resize(m_capacity); } // Finally, do the copy.