bugfix in emi2

"Kaido Karner" <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
re

well .. I started to separate my big patch into smaller pieces.

this one is just a bugfix .. in case of error, the privdata was used even if
it was freed.

kaido


diff -ur gateway-1.2.0/gw/smsc_emi2.c gateway-patched/gw/smsc_emi2.c
--- gateway-1.2.0/gw/smsc_emi2.c        Fri Jun 28 14:09:54 2002
+++ gateway-patched/gw/smsc_emi2.c      Wed Jul 17 11:54:31 2002
@@ -1606,8 +1606,6 @@
     privdata->deny_ip = deny_ip;

     if (privdata->rport > 0 && emi2_open_listening_socket(privdata) < 0) {
-       gw_free(privdata);
-       privdata = NULL;
        goto error;
     }

@@ -1651,12 +1649,13 @@
     if (privdata != NULL) {
        list_destroy(privdata->outgoing_queue, NULL);
     }
-    gw_free(privdata);
     octstr_destroy(allow_ip);
     octstr_destroy(deny_ip);
     octstr_destroy(host);
     conn->why_killed = SMSCCONN_KILLED_CANNOT_CONNECT;
     conn->status = SMSCCONN_DEAD;
     info(0, "EMI2[%s]: exiting", octstr_get_cstr(privdata->name));
+    gw_free(privdata);
+    privdata = NULL;
     return -1;
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.