path: root/openbsc
diff options
authorJacob Erlbeck <>2015-04-28 09:28:18 +0200
committerJacob Erlbeck <>2015-04-28 09:40:40 +0200
commit5a2484b10e8aeec3841833b79a8973cacb37bcee (patch)
tree4171cd58f9ed7c7d534abac0b1d984942e73dada /openbsc
parentcb43a9ac4489040185addd528a3143655ea349be (diff)
mgcp: Move assignment of src_codec downwards
Currently the src_codec const variable is set to &src_end->codec before src_end is checked against NULL. Since the assigment is just an address operation and the memory where it points to is only accessed after the NULL check, this does not harm technically. Nevertheless this is potential source for errors if that code is changed. This commit moves the definition below the NULL check. This does not comply with the coding style, but it cannot be split into definition and a later assignment due to the const qualifier. Sponsored-by: On-Waves ehf
Diffstat (limited to 'openbsc')
1 files changed, 2 insertions, 1 deletions
diff --git a/openbsc/src/libmgcp/mgcp_transcode.c b/openbsc/src/libmgcp/mgcp_transcode.c
index daf2510da..12cce2616 100644
--- a/openbsc/src/libmgcp/mgcp_transcode.c
+++ b/openbsc/src/libmgcp/mgcp_transcode.c
@@ -141,7 +141,6 @@ int mgcp_transcoding_setup(struct mgcp_endpoint *endp,
struct mgcp_process_rtp_state *state;
enum audio_format src_fmt, dst_fmt;
- const struct mgcp_rtp_codec *src_codec = &src_end->codec;
const struct mgcp_rtp_codec *dst_codec = &dst_end->codec;
/* cleanup first */
@@ -153,6 +152,8 @@ int mgcp_transcoding_setup(struct mgcp_endpoint *endp,
if (!src_end)
return 0;
+ const struct mgcp_rtp_codec *src_codec = &src_end->codec;
if (endp->tcfg->no_audio_transcoding) {
"Transcoding disabled on endpoint 0x%x\n",