Re: [PATCH] Minor Issue when alt-host is set on EMI/UCP
Alexander Malysh <[email protected]>
| Newsgroups | gmane.comp.mobile.kannel.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi, this patch has had memory leak, conn->name was never freed. I commited my version ;) Thanks, Alex Vincent CHAVANIS schrieb: > > As no objections here, > Thanks to commit it. > > > Vincent CHAVANIS a écrit : >> done. >> >> ----- Original Message ----- From: "Stipe Tolj" <[email protected]> >> Cc: <[email protected]>; "Vincent CHAVANIS" <[email protected]> >> Sent: Thursday, May 22, 2008 1:40 PM >> Subject: Re: [PATCH] Minor Issue when alt-host is set on EMI/UCP >> >> >>> Alexander Malysh schrieb: >>>> hi, >>>> >>>> ++1, sorry unable to commit now... >>> >>> I'm willing to commit. >>> >>> Vincent, can you resend the patch as attachment, so I can apply it >>> directly to CVS HEAD and commit?! >>> >>> Stipe >>> >>> ------------------------------------------------------------------- >>> Kölner Landstrasse 419 >>> 40589 Düsseldorf, NRW, Germany >>> >>> tolj.org system architecture Kannel Software Foundation (KSF) >>> http://www.tolj.org/ http://www.kannel.org/ >>> >>> mailto:st_{at}_tolj.org mailto:stolj_{at}_kannel.org >>> ------------------------------------------------------------------- >>> >> diff -rauw /gateway-cvs/gw/smsc/smsc_emi.c /gateway/gw/smsc/smsc_emi.c >> --- /gateway-cvs/gw/smsc/smsc_emi.c 2008-01-09 21:06:52.000000000 >> +0100 >> +++ /gateway/gw/smsc/smsc_emi.c 2008-05-06 17:35:04.000000000 +0200 >> @@ -267,7 +274,7 @@ >> static Connection *open_send_connection(SMSCConn *conn) >> { >> PrivData *privdata = conn->data; >> - int result, alt_host, do_alt_host; >> + int result, alt_host, do_alt_host, is_primary; >> struct emimsg *emimsg; >> Connection *server; >> Msg *msg; >> @@ -278,6 +285,7 @@ >> privdata->alt_port != 0; >> >> alt_host = 0; >> + is_primary = 1; >> >> mutex_lock(conn->flow_mutex); >> conn->status = SMSCCONN_RECONNECTING; >> @@ -307,6 +315,7 @@ >> alt_host=1; >> else >> alt_host=0; >> + is_primary=1; >> } else { >> info(0, "EMI2[%s]: connecting to Alternate SMSC", >> octstr_get_cstr(privdata->name)); >> @@ -316,6 +325,7 @@ >> (privdata->alt_port ? privdata->alt_port : >> privdata->port), >> privdata->our_port, conn->our_host); >> alt_host=0; >> + is_primary=0; >> } >> if (privdata->shutdown) { >> conn_destroy(server); >> @@ -364,6 +374,12 @@ >> mutex_lock(conn->flow_mutex); >> conn->status = SMSCCONN_ACTIVE; >> conn->connect_time = time(NULL); >> + if (is_primary == 0) >> + conn->name = octstr_format("EMI2:%S:%d:%S", >> privdata->alt_host, privdata->alt_port ? privdata->alt_port : >> privdata->port, >> + privdata->username ? >> privdata->username : octstr_imm("null")); >> + else >> + conn->name = octstr_format("EMI2:%S:%d:%S", >> privdata->host, privdata->port, >> + privdata->username ? >> privdata->username : octstr_imm("null")); >> mutex_unlock(conn->flow_mutex); >> bb_smscconn_connected(conn); >> return server; > > >