kdc: fix invalid free at exit time
This commit is contained in:
@@ -894,8 +894,10 @@ next_min_free(krb5_context context, struct descr **d, unsigned int *ndescr)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
loop(krb5_context context, krb5_kdc_configuration *config,
|
loop(krb5_context context, krb5_kdc_configuration *config,
|
||||||
struct descr *d, unsigned int ndescr, int islive)
|
struct descr **dp, unsigned int *ndescrp, int islive)
|
||||||
{
|
{
|
||||||
|
struct descr *d = *dp;
|
||||||
|
unsigned int ndescr = *ndescrp;
|
||||||
|
|
||||||
while (exit_flag == 0) {
|
while (exit_flag == 0) {
|
||||||
struct timeval tmout;
|
struct timeval tmout;
|
||||||
@@ -947,7 +949,9 @@ loop(krb5_context context, krb5_kdc_configuration *config,
|
|||||||
#endif
|
#endif
|
||||||
for (i = 0; i < ndescr; i++)
|
for (i = 0; i < ndescr; i++)
|
||||||
if (!rk_IS_BAD_SOCKET(d[i].s) && FD_ISSET(d[i].s, &fds)) {
|
if (!rk_IS_BAD_SOCKET(d[i].s) && FD_ISSET(d[i].s, &fds)) {
|
||||||
min_free = next_min_free(context, &d, &ndescr);
|
min_free = next_min_free(context, dp, ndescrp);
|
||||||
|
ndescr = *ndescrp;
|
||||||
|
d = *dp;
|
||||||
|
|
||||||
if (d[i].type == SOCK_DGRAM)
|
if (d[i].type == SOCK_DGRAM)
|
||||||
handle_udp(context, config, &d[i]);
|
handle_udp(context, config, &d[i]);
|
||||||
@@ -1177,7 +1181,7 @@ start_kdc(krb5_context context,
|
|||||||
switch (pid) {
|
switch (pid) {
|
||||||
case 0:
|
case 0:
|
||||||
close(islive[0]);
|
close(islive[0]);
|
||||||
loop(context, config, d, ndescr, islive[1]);
|
loop(context, config, &d, &ndescr, islive[1]);
|
||||||
exit(0);
|
exit(0);
|
||||||
case -1:
|
case -1:
|
||||||
/* XXXrcd: hmmm, do something useful?? */
|
/* XXXrcd: hmmm, do something useful?? */
|
||||||
@@ -1258,11 +1262,11 @@ start_kdc(krb5_context context,
|
|||||||
kdc_log(context, config, 0, "KDC master process exiting");
|
kdc_log(context, config, 0, "KDC master process exiting");
|
||||||
free(pids);
|
free(pids);
|
||||||
} else {
|
} else {
|
||||||
loop(context, config, d, ndescr, -1);
|
loop(context, config, &d, &ndescr, -1);
|
||||||
kdc_log(context, config, 0, "KDC exiting");
|
kdc_log(context, config, 0, "KDC exiting");
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
loop(context, config, d, ndescr, -1);
|
loop(context, config, &d, &ndescr, -1);
|
||||||
kdc_log(context, config, 0, "KDC exiting");
|
kdc_log(context, config, 0, "KDC exiting");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user