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

Max msuraev at sysmocom.de
Wed May 4 11:01:42 UTC 2016


I did not managed to reproduce memleak by manually triggering
db_sync_subscriber with "subscriber id 2 authorized 1" multiple times.
When does it happen?
Also, what to you suggest to improve readability?

I'll send revised version shortly.

On 05/03/2016 11:05 AM, Holger Freyther wrote:
>> 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

-- 
Max Suraev <msuraev at sysmocom.de> http://www.sysmocom.de/
======================================================================= 
* sysmocom - systems for mobile communications GmbH
* Alt-Moabit 93 
* 10559 Berlin, Germany
* Sitz / Registered office: Berlin, HRB 134158 B 
* Geschaeftsfuehrer / Managing Directors: Holger Freyther, Harald Welte 




More information about the OpenBSC mailing list