Coverity issues in lapd_core/gsm mncc

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.

Peter Stuge peter at stuge.se
Sat Jul 6 09:42:49 UTC 2013


Andreas Eversberg wrote:
> +++ b/src/gsm/lapd_core.c
> @@ -1950,7 +1950,7 @@ static int lapd_res_req(struct osmo_dlsap_prim *dp, struct lapd_msg_ctx *lctx)
>  	struct lapd_msg_ctx nctx;
>  
>  	LOGP(DLLAPD, LOGL_INFO, "perform re-establishment (SABM) length=%d\n",
> -		msg->len);
> +		(msg) ? msg->len : 0);
>  	
>  	/* be sure that history is empty */
>  	lapd_dl_flush_hist(dl);
> @@ -1962,11 +1962,14 @@ static int lapd_res_req(struct osmo_dlsap_prim *dp, struct lapd_msg_ctx *lctx)
>  	if (dl->send_buffer)
>  		msgb_free(dl->send_buffer);
>  	dl->send_out = 0;
> -	if (msg && msg->len)
> +	if (msg && msg->len) {
>  		/* Write data into the send buffer, to be sent first */
>  		dl->send_buffer = msg;
> -	else
> +	} else {
> +		if (msg)
> +			msgb_free(msg);
>  		dl->send_buffer = NULL;
> +	}

Does msg also need to be set to NULL after the above msgb_free()?


//Peter




More information about the OpenBSC mailing list