Change in osmo-mgw[master]: mgcp_client: do not crash when lco/sdp can not be generated

dexter gerrit-no-reply at
Wed Jun 2 20:02:35 UTC 2021

dexter has posted comments on this change. ( )

Change subject: mgcp_client: do not crash when lco/sdp can not be generated

Patch Set 2:

File src/libosmo-mgcp-client/mgcp_client.c: 
PS1, Line 1122: 				rc += -1;
> Agree with pau, it's not clear why we subtract. […]
The error code handling here is not obvious at the first look. The return codes from msgb_printf() are added up. Since msgb_printf() either return 0 (success) or -EINVAL a sum of 0 means that everything went well. However the check 0 is done at the end and it is reserved for msgb buffer space issues only, so subtracting -1 will appear as a buffer space issue but it is not. The correct way to do this is to free the msg buffer and to return -2. This requires a return code check by the caller of course.

So subtracting -1 wouln't have done any harm other than causing a slightly wrong error diagnosis. 
PS1, Line 1234: 				rc += -1;
> +1
To be conform with the rest it should indeed not do that. It should free the buffer and return -2 (see code above)

To view, visit
To unsubscribe, or for help writing mail filters, visit

Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: Ibb788343e0bec9c0eaf33e6e4727d4d36c100017
Gerrit-Change-Number: 24182
Gerrit-PatchSet: 2
Gerrit-Owner: dexter <pmaier at>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at>
Gerrit-Reviewer: neels <nhofmeyr at>
Gerrit-Reviewer: pespin <pespin at>
Gerrit-Comment-Date: Wed, 02 Jun 2021 20:02:35 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: laforge <laforge at>
Comment-In-Reply-To: pespin <pespin at>
Gerrit-MessageType: comment
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the gerrit-log mailing list