[PATCH] Make random MSISDN assignment optional

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/.

Holger Freyther holger at freyther.de
Tue May 3 09:05:48 UTC 2016


> On 03 May 2016, at 10:43, msuraev at sysmocom.de wrote:
> 
> +	if (subscriber->extension[0] != '\0')
> +		dbi_conn_quote_string_copy(conn,
> +					   subscriber->extension, &q_extension);
> +	else
> +		q_extension = strdup("NULL");
> 	
> 	if (subscriber->tmsi != GSM_RESERVED_TMSI) {
> 		sprintf(tmsi, "%u", subscriber->tmsi);
> @@ -1043,15 +1049,17 @@ int db_subscriber_delete(struct gsm_subscriber *subscr)
> 	}
> 	dbi_result_free(result);
> 
> -	result = dbi_conn_queryf(conn,
> -			"DELETE FROM SMS WHERE src_addr=%s OR dest_addr=%s",
> -			subscr->extension, subscr->extension);
> -	if (!result) {
> -		LOGP(DDB, LOGL_ERROR,
> -			"Failed to delete SMS for %llu\n", subscr->id);
> -		return -1;
> +	if (subscr->extension[0] != '\0') {
> +		result = dbi_conn_queryf(conn,
> +			    "DELETE FROM SMS WHERE src_addr=%s OR dest_addr=%s",
> +					 subscr->extension, subscr->extension);
> +		if (!result) {
> +			LOGP(DDB, LOGL_ERROR,
> +			     "Failed to delete SMS for %llu\n", subscr->id);
> +			return -1;
> +		}
> +		dbi_result_free(result);
> 	}
> -	dbi_result_free(result);

Starts to be less readable, q_extension will leak in the error path as well (and probably leaked before as well).

holger


More information about the OpenBSC mailing list