From 988f118ba9de91010546b8e0fcedd8dc8a8a16d4 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Tue, 25 Jan 2022 11:55:21 -0500 Subject: [PATCH] Fix fail to get Sources in RTSP. the string msg although initially reserved to ZM_NETWORK_BUFSIZ, after use it's capacity is changed whatever it's contents are. So need to re-reserve. --- src/zm_comms.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/zm_comms.h b/src/zm_comms.h index 070ed5395..ce316b17b 100644 --- a/src/zm_comms.h +++ b/src/zm_comms.h @@ -244,6 +244,7 @@ class Socket : public CommsBase { } virtual ssize_t recv(std::string &msg) const { + msg.reserve(ZM_NETWORK_BUFSIZ); std::vector buffer(msg.capacity()); ssize_t nBytes; if ((nBytes = ::recv(mSd, buffer.data(), buffer.size(), 0)) < 0) {