mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-17 15:27:36 +00:00
Destroy struct chat when it's finished in struct datalink.
Initialise chat timers correctly as they're malloc()ed as part of struct datalink, and initially contain garbage.
This commit is contained in:
parent
cdbbb6b571
commit
39d946522c
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/cvs2svn/branches/MP/; revision=35276
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: bundle.c,v 1.1.2.51 1998/04/17 22:04:18 brian Exp $
|
||||
* $Id: bundle.c,v 1.1.2.52 1998/04/17 22:05:03 brian Exp $
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -889,7 +889,7 @@ bundle_IdleTimeout(void *v)
|
||||
struct bundle *bundle = (struct bundle *)v;
|
||||
|
||||
bundle->idle.done = 0;
|
||||
LogPrintf(LogPHASE, "IPCP Idle timer expired.\n");
|
||||
LogPrintf(LogPHASE, "Idle timer expired.\n");
|
||||
bundle_Close(bundle, NULL, 1);
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: chat.c,v 1.44.2.22 1998/04/10 23:51:24 brian Exp $
|
||||
* $Id: chat.c,v 1.44.2.23 1998/04/18 01:01:15 brian Exp $
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -545,18 +545,18 @@ chat_Init(struct chat *c, struct physical *p, const char *data, int emptybuf,
|
||||
c->phone = phone;
|
||||
c->abort.num = 0;
|
||||
|
||||
StopTimer(&c->pause);
|
||||
c->pause.state = TIMER_STOPPED;
|
||||
|
||||
StopTimer(&c->timeout);
|
||||
c->timeout.state = TIMER_STOPPED;
|
||||
memset(&c->pause, '\0', sizeof c->pause);
|
||||
memset(&c->timeout, '\0', sizeof c->timeout);
|
||||
}
|
||||
|
||||
void
|
||||
chat_Destroy(struct chat *c)
|
||||
{
|
||||
StopTimer(&c->pause);
|
||||
StopTimer(&c->timeout);
|
||||
while (c->abort.num)
|
||||
free(c->abort.string[--c->abort.num].data);
|
||||
c->abort.num = 0;
|
||||
}
|
||||
|
||||
static char *
|
||||
|
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: datalink.c,v 1.1.2.39 1998/04/17 22:04:25 brian Exp $
|
||||
* $Id: datalink.c,v 1.1.2.40 1998/04/18 01:01:19 brian Exp $
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -268,6 +268,7 @@ datalink_UpdateSet(struct descriptor *d, fd_set *r, fd_set *w, fd_set *e,
|
||||
switch (dl->chat.state) {
|
||||
case CHAT_DONE:
|
||||
/* script succeeded */
|
||||
chat_Destroy(&dl->chat);
|
||||
switch(dl->state) {
|
||||
case DATALINK_HANGUP:
|
||||
datalink_HangupDone(dl);
|
||||
@ -285,6 +286,7 @@ datalink_UpdateSet(struct descriptor *d, fd_set *r, fd_set *w, fd_set *e,
|
||||
case CHAT_FAILED:
|
||||
/* Going down - script failed */
|
||||
LogPrintf(LogWARN, "Chat script failed\n");
|
||||
chat_Destroy(&dl->chat);
|
||||
switch(dl->state) {
|
||||
case DATALINK_HANGUP:
|
||||
datalink_HangupDone(dl);
|
||||
@ -620,12 +622,19 @@ datalink_Destroy(struct datalink *dl)
|
||||
{
|
||||
struct datalink *result;
|
||||
|
||||
if (dl->state != DATALINK_CLOSED)
|
||||
if (dl->state != DATALINK_CLOSED) {
|
||||
LogPrintf(LogERROR, "Oops, destroying a datalink in state %s\n",
|
||||
datalink_State(dl));
|
||||
switch (dl->state) {
|
||||
case DATALINK_HANGUP:
|
||||
case DATALINK_DIAL:
|
||||
case DATALINK_LOGIN:
|
||||
chat_Destroy(&dl->chat); /* Gotta blat the timers ! */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
result = dl->next;
|
||||
chat_Destroy(&dl->chat);
|
||||
modem_Destroy(dl->physical);
|
||||
free(dl->name);
|
||||
free(dl);
|
||||
|
@ -17,7 +17,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: timer.c,v 1.27.2.4 1998/04/07 00:54:22 brian Exp $
|
||||
* $Id: timer.c,v 1.27.2.5 1998/04/17 22:04:36 brian Exp $
|
||||
*
|
||||
* TODO:
|
||||
*/
|
||||
@ -144,7 +144,7 @@ StopTimerNoBlock(struct pppTimer * tp)
|
||||
}
|
||||
|
||||
static void
|
||||
TimerService()
|
||||
TimerService(void)
|
||||
{
|
||||
struct pppTimer *tp, *exp, *wt;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user