1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-25 01:02:24 +00:00

It's not legal to free a coroutine's state structure before invoking

crFinish or crFinishV, since they will attempt to write to the
coroutine state variable contained in that structure. Introduced some
new all-in-one macros crFinishFree and crFinishFreeV, and used those
instead. Should fix today's report of a crash just after authentication.

[originally from svn r9630]
This commit is contained in:
Simon Tatham 2012-08-27 14:34:41 +00:00
parent 85c95e30e4
commit 3fa95b2a7f

16
ssh.c
View File

@ -439,6 +439,8 @@ enum {
#define crState(t) crStateP(t, ssh->t)
#define crFinish(z) } *crLine = 0; return (z); }
#define crFinishV } *crLine = 0; return; }
#define crFinishFree(z, s) } *crLine = 0; sfree(s); return (z); }
#define crFinishFreeV(s) } *crLine = 0; sfree(s); return; }
#define crReturn(z) \
do {\
*crLine =__LINE__; return (z); case __LINE__:;\
@ -7513,8 +7515,7 @@ static void ssh2_maybe_setup_x11(struct ssh_channel *c, struct Packet *pktin,
logevent("X11 forwarding refused");
}
}
sfree(s);
crFinishV;
crFinishFreeV(s);
}
static void ssh2_maybe_setup_agent(struct ssh_channel *c, struct Packet *pktin,
@ -7545,8 +7546,7 @@ static void ssh2_maybe_setup_agent(struct ssh_channel *c, struct Packet *pktin,
logevent("Agent forwarding refused");
}
}
sfree(s);
crFinishV;
crFinishFreeV(s);
}
static void ssh2_maybe_setup_pty(struct ssh_channel *c, struct Packet *pktin,
@ -7599,8 +7599,7 @@ static void ssh2_maybe_setup_pty(struct ssh_channel *c, struct Packet *pktin,
} else {
ssh->editing = ssh->echoing = 1;
}
sfree(s);
crFinishV;
crFinishFreeV(s);
}
static void ssh2_setup_env(struct ssh_channel *c, struct Packet *pktin,
@ -7663,9 +7662,8 @@ static void ssh2_setup_env(struct ssh_channel *c, struct Packet *pktin,
c_write_str(ssh, "Server refused to set all environment variables\r\n");
}
}
out:
sfree(s);
crFinishV;
out:;
crFinishFreeV(s);
}
/*