From 4bec183a9a93989085d077fa6c73f09cb5f420c1 Mon Sep 17 00:00:00 2001 From: Donat Zenichev Date: Mon, 15 May 2023 16:19:17 +0200 Subject: [PATCH] MT#57445 '.SdpPayload::type' may be used uninitialized in this function We have to explicitly set the `SdpPayload.type`, when calling the constructor of it, which only initializes the `SdpPayload.payload_type`. Just simply set the `SdpPayload.type` to -1. This fixes the following: In file included from ../../core/AmRtpStream.h:32, from ../../core/AmSession.h:31, from ../../core/AmB2BSession.h:31, from CallLeg.h:29, from CallLeg.cpp:27: ../../core/AmSdp.h: In member function 'void CallLeg::acceptPendingInvite(AmSipRequest*)': ../../core/AmSdp.h:130:18: warning: '.SdpPayload::type' may be used uninitialized in this function [-Wmaybe-uninitialized] 130 | : type(other.type), payload_type(other.payload_type), | ~~~~~~^~~~ Change-Id: I08a9e75396f043dc88d411b9c84296a704d67057 --- core/AmSdp.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/AmSdp.h b/core/AmSdp.h index d7408195..8966ed16 100644 --- a/core/AmSdp.h +++ b/core/AmSdp.h @@ -116,7 +116,8 @@ struct SdpPayload {} SdpPayload(int pt) - : payload_type(pt), + : type(-1), + payload_type(pt), clock_rate(-1), encoding_param(-1) {}