From 782414a8b7966c91f4bc4da5294eb011a01af599 Mon Sep 17 00:00:00 2001 From: Tristan Matthews <tristan.matthews@savoirfairelinux.com> Date: Fri, 18 Jul 2014 11:01:44 -0400 Subject: [PATCH] sipcall: use unique_ptr instead of raw pointer Rationale: This changes nothing functionally but since unique pointers have stricter semantics than raw pointers, it avoids future mis-use. Refs #51555 Change-Id: I8ee8b64a220df07af25ae760b50dfcc731fed4b9 --- daemon/src/sip/sipcall.cpp | 3 ++- daemon/src/sip/sipcall.h | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/daemon/src/sip/sipcall.cpp b/daemon/src/sip/sipcall.cpp index d4701472b5..abc3032c1c 100644 --- a/daemon/src/sip/sipcall.cpp +++ b/daemon/src/sip/sipcall.cpp @@ -110,7 +110,8 @@ SIPCall::SIPCall(const std::string& id, Call::CallType type, SIPCall::~SIPCall() { - delete local_sdp_; + // local sdp must be destroyed before pool + local_sdp_.reset(); pj_pool_release(pool_); } diff --git a/daemon/src/sip/sipcall.h b/daemon/src/sip/sipcall.h index 2ac8f7e93b..5c8079d337 100644 --- a/daemon/src/sip/sipcall.h +++ b/daemon/src/sip/sipcall.h @@ -46,6 +46,8 @@ #include "pjsip/sip_config.h" +#include <memory> + struct pjsip_evsub; struct pj_caching_pool; struct pj_pool_t; @@ -202,7 +204,7 @@ class SIPCall : public Call { /** * The SDP session */ - Sdp* local_sdp_; + std::unique_ptr<Sdp> local_sdp_; char contactBuffer_[PJSIP_MAX_URL_SIZE]; pj_str_t contactHeader_; -- GitLab