Check-in [e9b1098ae1]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Joe Yates's memory leak patches.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: e9b1098ae1fabf0cb90ca90331e956403437c07f
User & Date: simon 2003-12-19 06:44:46.000
Context
2003-12-31
10:09
D'oh! WideFont and WideBoldFont were being read from session files, but not written. I _thought_ something odd was happening with my UTF-8 pterms. check-in: 0b63c7c0f9 user: simon tags: trunk
2003-12-19
06:44
Joe Yates's memory leak patches. check-in: e9b1098ae1 user: simon tags: trunk
2003-12-16
12:28
Andy Hood points out that `#ifdef MONITOR_DEFAULTTONEAREST' would benefit from _also_ being conditional on NO_MULTIMON not being defined, to prevent the possibility of only half the multimon code being included. check-in: be5ecc4c16 user: simon tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to cmdline.c.
46
47
48
49
50
51
52








53
54
55
56
57
58
59
	saves[pri].params = sresize(saves[pri].params, saves[pri].savesize,
				    struct cmdline_saved_param);
    }
    saves[pri].params[saves[pri].nsaved].p = p;
    saves[pri].params[saves[pri].nsaved].value = value;
    saves[pri].nsaved++;
}









#define SAVEABLE(pri) do { \
    if (need_save) { cmdline_save_param(p, value, pri); return ret; } \
} while (0)

char *cmdline_password = NULL;








>
>
>
>
>
>
>
>







46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
	saves[pri].params = sresize(saves[pri].params, saves[pri].savesize,
				    struct cmdline_saved_param);
    }
    saves[pri].params[saves[pri].nsaved].p = p;
    saves[pri].params[saves[pri].nsaved].value = value;
    saves[pri].nsaved++;
}

void cmdline_cleanup(void)
{
    int pri;

    for (pri = 0; pri < NPRIORITIES; pri++)
	sfree(saves[pri].params);
}

#define SAVEABLE(pri) do { \
    if (need_save) { cmdline_save_param(p, value, pri); return ret; } \
} while (0)

char *cmdline_password = NULL;

Changes to psftp.c.
21
22
23
24
25
26
27

28
29
30
31
32
33
34
 * no buffer management: when we send data, we stop and wait for an
 * acknowledgement _anyway_, and so we can't possibly overfill our
 * send buffer.
 */

static int psftp_connect(char *userhost, char *user, int portnumber);
static int do_sftp_init(void);


/* ----------------------------------------------------------------------
 * sftp client state.
 */

char *pwd, *homedir;
static Backend *back;







>







21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
 * no buffer management: when we send data, we stop and wait for an
 * acknowledgement _anyway_, and so we can't possibly overfill our
 * send buffer.
 */

static int psftp_connect(char *userhost, char *user, int portnumber);
static int do_sftp_init(void);
void do_sftp_cleanup();

/* ----------------------------------------------------------------------
 * sftp client state.
 */

char *pwd, *homedir;
static Backend *back;
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
	/*
	 * Special case: the ! command. This is always parsed as
	 * exactly two words: one containing the !, and the second
	 * containing everything else on the line.
	 */
	cmd->nwords = cmd->wordssize = 2;
	cmd->words = sresize(cmd->words, cmd->wordssize, char *);
	cmd->words[0] = "!";
	cmd->words[1] = p+1;
    } else {

	/*
	 * Parse the command line into words. The syntax is:
	 *  - double quotes are removed, but cause spaces within to be
	 *    treated as non-separating.
	 *  - a double-doublequote pair is a literal double quote, inside







|
|







1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
	/*
	 * Special case: the ! command. This is always parsed as
	 * exactly two words: one containing the !, and the second
	 * containing everything else on the line.
	 */
	cmd->nwords = cmd->wordssize = 2;
	cmd->words = sresize(cmd->words, cmd->wordssize, char *);
	cmd->words[0] = dupstr("!");
	cmd->words[1] = dupstr(p+1);
    } else {

	/*
	 * Parse the command line into words. The syntax is:
	 *  - double quotes are removed, but cause spaces within to be
	 *    treated as non-separating.
	 *  - a double-doublequote pair is a literal double quote, inside
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454

1455
1456
1457
1458
1459
1460
1461
	    if (*p)
		p++;		       /* skip over the whitespace */
	    *r = '\0';
	    if (cmd->nwords >= cmd->wordssize) {
		cmd->wordssize = cmd->nwords + 16;
		cmd->words = sresize(cmd->words, cmd->wordssize, char *);
	    }
	    cmd->words[cmd->nwords++] = q;
	}
    }


    /*
     * Now parse the first word and assign a function.
     */

    if (cmd->nwords == 0)
	cmd->obey = sftp_cmd_null;
    else {







|



>







1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
	    if (*p)
		p++;		       /* skip over the whitespace */
	    *r = '\0';
	    if (cmd->nwords >= cmd->wordssize) {
		cmd->wordssize = cmd->nwords + 16;
		cmd->words = sresize(cmd->words, cmd->wordssize, char *);
	    }
	    cmd->words[cmd->nwords++] = dupstr(q);
	}
    }

	sfree(line);
    /*
     * Now parse the first word and assign a function.
     */

    if (cmd->nwords == 0)
	cmd->obey = sftp_cmd_null;
    else {
1499
1500
1501
1502
1503
1504
1505

















1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524

1525







1526
1527
1528
1529
1530
1531
1532
	homedir = dupstr(".");
    } else {
	printf("Remote working directory is %s\n", homedir);
    }
    pwd = dupstr(homedir);
    return 0;
}


















void do_sftp(int mode, int modeflags, char *batchfile)
{
    FILE *fp;
    int ret;

    /*
     * Batch mode?
     */
    if (mode == 0) {

        /* ------------------------------------------------------------------
         * Now we're ready to do Real Stuff.
         */
        while (1) {
	    struct sftp_command *cmd;
	    cmd = sftp_getcmd(stdin, 0, 0);
	    if (!cmd)
		break;

	    if (cmd->obey(cmd) < 0)







		break;
	}
    } else {
        fp = fopen(batchfile, "r");
        if (!fp) {
	    printf("Fatal: unable to open %s\n", batchfile);
	    return;







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>



















>
|
>
>
>
>
>
>
>







1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
	homedir = dupstr(".");
    } else {
	printf("Remote working directory is %s\n", homedir);
    }
    pwd = dupstr(homedir);
    return 0;
}

void do_sftp_cleanup()
{
    char ch;
    back->special(backhandle, TS_EOF);
    sftp_recvdata(&ch, 1);
    back->free(backhandle);
    sftp_cleanup_request();
    if (pwd) {
	sfree(pwd);
	pwd = NULL;
    }
    if (homedir) {
	sfree(homedir);
	homedir = NULL;
    }
}

void do_sftp(int mode, int modeflags, char *batchfile)
{
    FILE *fp;
    int ret;

    /*
     * Batch mode?
     */
    if (mode == 0) {

        /* ------------------------------------------------------------------
         * Now we're ready to do Real Stuff.
         */
        while (1) {
	    struct sftp_command *cmd;
	    cmd = sftp_getcmd(stdin, 0, 0);
	    if (!cmd)
		break;
	    ret = cmd->obey(cmd);
	    if (cmd->words) {
		int i;
		for(i = 0; i < cmd->nwords; i++)
		    sfree(cmd->words[i]);
		sfree(cmd->words);
	    }
	    sfree(cmd);
	    if (ret < 0)
		break;
	}
    } else {
        fp = fopen(batchfile, "r");
        if (!fp) {
	    printf("Fatal: unable to open %s\n", batchfile);
	    return;
1904
1905
1906
1907
1908
1909
1910


1911
1912
1913
1914
1915
1916
1917
	if (ssh_sftp_loop_iteration() < 0) {
	    fprintf(stderr, "ssh_init: error during SSH connection setup\n");
	    return 1;
	}
    }
    if (verbose && realhost != NULL)
	printf("Connected to %s\n", realhost);


    return 0;
}

void cmdline_error(char *p, ...)
{
    va_list ap;
    fprintf(stderr, "psftp: ");







>
>







1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
	if (ssh_sftp_loop_iteration() < 0) {
	    fprintf(stderr, "ssh_init: error during SSH connection setup\n");
	    return 1;
	}
    }
    if (verbose && realhost != NULL)
	printf("Connected to %s\n", realhost);
    if (realhost != NULL)
	sfree(realhost);
    return 0;
}

void cmdline_error(char *p, ...)
{
    va_list ap;
    fprintf(stderr, "psftp: ");
1989
1990
1991
1992
1993
1994
1995

1996


1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012






2013
2014
2015
    back = NULL;

    /*
     * If a user@host string has already been provided, connect to
     * it now.
     */
    if (userhost) {

	if (psftp_connect(userhost, user, portnumber))


	    return 1;
	if (do_sftp_init())
	    return 1;
    } else {
	printf("psftp: no hostname specified; use \"open host.name\""
	    " to connect\n");
    }

    do_sftp(mode, modeflags, batchfile);

    if (back != NULL && back->socket(backhandle) != NULL) {
	char ch;
	back->special(backhandle, TS_EOF);
	sftp_recvdata(&ch, 1);
    }
    random_save_seed();







    return 0;
}







>
|
>
>





|










>
>
>
>
>
>



2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
    back = NULL;

    /*
     * If a user@host string has already been provided, connect to
     * it now.
     */
    if (userhost) {
	int ret;
	ret = psftp_connect(userhost, user, portnumber);
	sfree(userhost);
	if (ret)
	    return 1;
	if (do_sftp_init())
	    return 1;
    } else {
	printf("psftp: no hostname specified; use \"open host.name\""
	       " to connect\n");
    }

    do_sftp(mode, modeflags, batchfile);

    if (back != NULL && back->socket(backhandle) != NULL) {
	char ch;
	back->special(backhandle, TS_EOF);
	sftp_recvdata(&ch, 1);
    }
    random_save_seed();
    cmdline_cleanup();
    console_provide_logctx(NULL);
    do_sftp_cleanup();
    backhandle = NULL;
    back = NULL;
    sk_cleanup();

    return 0;
}
Changes to putty.h.
810
811
812
813
814
815
816

817
818
819
820
821
822
823
/*
 * Exports from cmdline.c (and also cmdline_error(), which is
 * defined differently in various places and required _by_
 * cmdline.c).
 */
int cmdline_process_param(char *, char *, int, Config *);
void cmdline_run_saved(Config *);

extern char *cmdline_password;
#define TOOLTYPE_FILETRANSFER 1
#define TOOLTYPE_NONNETWORK 2
extern int cmdline_tooltype;

void cmdline_error(char *, ...);








>







810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
/*
 * Exports from cmdline.c (and also cmdline_error(), which is
 * defined differently in various places and required _by_
 * cmdline.c).
 */
int cmdline_process_param(char *, char *, int, Config *);
void cmdline_run_saved(Config *);
void cmdline_cleanup(void);
extern char *cmdline_password;
#define TOOLTYPE_FILETRANSFER 1
#define TOOLTYPE_NONNETWORK 2
extern int cmdline_tooltype;

void cmdline_error(char *, ...);

Changes to scp.c.
2174
2175
2176
2177
2178
2179
2180






2181
2182
2183
2184
	ssh_scp_recv(&ch, 1);
    }
    random_save_seed();

    if (gui_mode)
	gui_send_errcount(list, errs);







    return (errs == 0 ? 0 : 1);
}

/* end */







>
>
>
>
>
>




2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
	ssh_scp_recv(&ch, 1);
    }
    random_save_seed();

    if (gui_mode)
	gui_send_errcount(list, errs);

    cmdline_cleanup();
    console_provide_logctx(NULL);
    back->free(backhandle);
    backhandle = NULL;
    back = NULL;
    sk_cleanup();
    return (errs == 0 ? 0 : 1);
}

/* end */
Changes to sftp.c.
329
330
331
332
333
334
335








336
337
338
339
340
341
342
    r = snew(struct sftp_request);
    r->id = low + 1 + REQUEST_ID_OFFSET;
    r->registered = 0;
    r->userdata = NULL;
    add234(sftp_requests, r);
    return r;
}









void sftp_register(struct sftp_request *req)
{
    req->registered = 1;
}

struct sftp_request *sftp_find_request(struct sftp_packet *pktin)







>
>
>
>
>
>
>
>







329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
    r = snew(struct sftp_request);
    r->id = low + 1 + REQUEST_ID_OFFSET;
    r->registered = 0;
    r->userdata = NULL;
    add234(sftp_requests, r);
    return r;
}

void sftp_cleanup_request(void)
{
    if (sftp_requests == NULL) {
	freetree234(sftp_requests);
	sftp_requests = NULL;
    }
}

void sftp_register(struct sftp_request *req)
{
    req->registered = 1;
}

struct sftp_request *sftp_find_request(struct sftp_packet *pktin)
Changes to sftp.h.
63
64
65
66
67
68
69





70
71
72
73
74
75
76
 * until len is available, or it returns failure.
 * 
 * Both functions return 1 on success, 0 on failure.
 */
int sftp_senddata(char *data, int len);
int sftp_recvdata(char *data, int len);






struct fxp_attrs {
    unsigned long flags;
    uint64 size;
    unsigned long uid;
    unsigned long gid;
    unsigned long permissions;
    unsigned long atime;







>
>
>
>
>







63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
 * until len is available, or it returns failure.
 * 
 * Both functions return 1 on success, 0 on failure.
 */
int sftp_senddata(char *data, int len);
int sftp_recvdata(char *data, int len);

/*
 * Free sftp_requests
 */
void sftp_cleanup_request(void);

struct fxp_attrs {
    unsigned long flags;
    uint64 size;
    unsigned long uid;
    unsigned long gid;
    unsigned long permissions;
    unsigned long atime;
Changes to ssh.c.
2531
2532
2533
2534
2535
2536
2537
















2538
2539
2540
2541
2542
2543
2544
    ssh->v1_cipher_ctx = ssh->cipher->make_context();
    ssh->cipher->sesskey(ssh->v1_cipher_ctx, ssh->session_key);
    logeventf(ssh, "Initialised %s encryption", ssh->cipher->text_name);

    ssh->crcda_ctx = crcda_make_context();
    logevent("Installing CRC compensation attack detector");

















    crWaitUntil(ispkt);

    if (ssh->pktin.type != SSH1_SMSG_SUCCESS) {
	bombout(("Encryption not successfully enabled"));
	crStop(0);
    }








>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
    ssh->v1_cipher_ctx = ssh->cipher->make_context();
    ssh->cipher->sesskey(ssh->v1_cipher_ctx, ssh->session_key);
    logeventf(ssh, "Initialised %s encryption", ssh->cipher->text_name);

    ssh->crcda_ctx = crcda_make_context();
    logevent("Installing CRC compensation attack detector");

    if (servkey.modulus) {
	sfree(servkey.modulus);
	servkey.modulus = NULL;
    }
    if (servkey.exponent) {
	sfree(servkey.exponent);
	servkey.exponent = NULL;
    }
    if (hostkey.modulus) {
	sfree(hostkey.modulus);
	hostkey.modulus = NULL;
    }
    if (hostkey.exponent) {
	sfree(hostkey.exponent);
	hostkey.exponent = NULL;
    }
    crWaitUntil(ispkt);

    if (ssh->pktin.type != SSH1_SMSG_SUCCESS) {
	bombout(("Encryption not successfully enabled"));
	crStop(0);
    }

3033
3034
3035
3036
3037
3038
3039

3040
3041
3042
3043
3044
3045
3046
			    randomstr[i] = '\0';
			    defer_packet(ssh, SSH1_MSG_IGNORE,
					 PKT_STR, randomstr, PKT_END);
			}
		    }
		    logevent("Sending password with camouflage packets");
		    ssh_pkt_defersend(ssh);

		} 
		else if (!(ssh->remote_bugs & BUG_NEEDS_SSH1_PLAIN_PASSWORD)) {
		    /*
		     * The server can't deal with SSH1_MSG_IGNORE
		     * but can deal with padded passwords, so we
		     * can use the secondary defence.
		     */







>







3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
			    randomstr[i] = '\0';
			    defer_packet(ssh, SSH1_MSG_IGNORE,
					 PKT_STR, randomstr, PKT_END);
			}
		    }
		    logevent("Sending password with camouflage packets");
		    ssh_pkt_defersend(ssh);
		    sfree(randomstr);
		} 
		else if (!(ssh->remote_bugs & BUG_NEEDS_SSH1_PLAIN_PASSWORD)) {
		    /*
		     * The server can't deal with SSH1_MSG_IGNORE
		     * but can deal with padded passwords, so we
		     * can use the secondary defence.
		     */
4334
4335
4336
4337
4338
4339
4340




4341
4342
4343
4344
4345
4346
4347
	      ssh->sccipher->text_name);
    if (ssh->cscomp->text_name)
	logeventf(ssh, "Initialised %s compression",
		  ssh->cscomp->text_name);
    if (ssh->sccomp->text_name)
	logeventf(ssh, "Initialised %s decompression",
		  ssh->sccomp->text_name);





    /*
     * If this is the first key exchange phase, we must pass the
     * SSH2_MSG_NEWKEYS packet to the next layer, not because it
     * wants to see it but because it will need time to initialise
     * itself before it sees an actual packet. In subsequent key
     * exchange phases, we don't pass SSH2_MSG_NEWKEYS on, because







>
>
>
>







4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
	      ssh->sccipher->text_name);
    if (ssh->cscomp->text_name)
	logeventf(ssh, "Initialised %s compression",
		  ssh->cscomp->text_name);
    if (ssh->sccomp->text_name)
	logeventf(ssh, "Initialised %s decompression",
		  ssh->sccomp->text_name);
    freebn(s->f);
    freebn(s->g);
    freebn(s->K);
    freebn(s->p);

    /*
     * If this is the first key exchange phase, we must pass the
     * SSH2_MSG_NEWKEYS packet to the next layer, not because it
     * wants to see it but because it will need time to initialise
     * itself before it sees an actual packet. In subsequent key
     * exchange phases, we don't pass SSH2_MSG_NEWKEYS on, because
6274
6275
6276
6277
6278
6279
6280



6281












6282
6283
6284
6285
6286
6287
6288
    sfree(ssh->deferred_send_data);
    if (ssh->x11auth)
	x11_free_auth(ssh->x11auth);
    sfree(ssh->do_ssh_init_state);
    sfree(ssh->do_ssh1_login_state);
    sfree(ssh->do_ssh2_transport_state);
    sfree(ssh->do_ssh2_authconn_state);



    












    if (ssh->s)
	ssh_do_close(ssh);
    sfree(ssh);
}

/*
 * Reconfigure the SSH backend.







>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>







6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
    sfree(ssh->deferred_send_data);
    if (ssh->x11auth)
	x11_free_auth(ssh->x11auth);
    sfree(ssh->do_ssh_init_state);
    sfree(ssh->do_ssh1_login_state);
    sfree(ssh->do_ssh2_transport_state);
    sfree(ssh->do_ssh2_authconn_state);
    if (ssh->pktout.data) {
	sfree(ssh->pktout.data);
	ssh->pktout.data = NULL;
    }
    if (ssh->pktin.data) {
	sfree(ssh->pktin.data);
	ssh->pktin.data = NULL;
    }
    if (ssh->crcda_ctx) {
	crcda_free_context(ssh->crcda_ctx);
	ssh->crcda_ctx = NULL;
    }
    if (ssh->logctx) {
	log_free(ssh->logctx);
	ssh->logctx = NULL;
    }
    if (ssh->s)
	ssh_do_close(ssh);
    sfree(ssh);
}

/*
 * Reconfigure the SSH backend.
Changes to sshcrcda.c.
67
68
69
70
71
72
73




74

75
76
77
78
79
80
81
    ret->h = NULL;
    ret->n = HASH_MINSIZE / HASH_ENTRYSIZE;
    return ret;
}

void crcda_free_context(void *handle)
{




    sfree(handle);

}

static void crc_update(uint32 *a, void *b)
{
    *a = crc32_update(*a, b, 4);
}








>
>
>
>
|
>







67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
    ret->h = NULL;
    ret->n = HASH_MINSIZE / HASH_ENTRYSIZE;
    return ret;
}

void crcda_free_context(void *handle)
{
    struct crcda_ctx *ctx = (struct crcda_ctx *)handle;
    if (ctx) {
	sfree(ctx->h);
	ctx->h = NULL;
	sfree(ctx);
    }
}

static void crc_update(uint32 *a, void *b)
{
    *a = crc32_update(*a, b, 4);
}

Changes to sshrsa.c.
734
735
736
737
738
739
740

741
742
743
744
745
746
747
    }
    /* Finally, we expect to see the SHA-1 hash of the signed data. */
    SHA_Simple(data, datalen, hash);
    for (i = 19, j = 0; i >= 0; i--, j++) {
	if (bignum_byte(out, i) != hash[j])
	    ret = 0;
    }


    return ret;
}

static unsigned char *rsa2_sign(void *key, char *data, int datalen,
				int *siglen)
{







>







734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
    }
    /* Finally, we expect to see the SHA-1 hash of the signed data. */
    SHA_Simple(data, datalen, hash);
    for (i = 19, j = 0; i >= 0; i--, j++) {
	if (bignum_byte(out, i) != hash[j])
	    ret = 0;
    }
    freebn(out);

    return ret;
}

static unsigned char *rsa2_sign(void *key, char *data, int datalen,
				int *siglen)
{
Changes to winnet.c.
233
234
235
236
237
238
239


240
241
242
243
244
245
246
    Actual_Socket s;
    int i;

    if (sktree) {
	for (i = 0; (s = index234(sktree, i)) != NULL; i++) {
	    p_closesocket(s->s);
	}


    }

    p_WSACleanup();
    if (winsock_module)
	FreeLibrary(winsock_module);
}








>
>







233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
    Actual_Socket s;
    int i;

    if (sktree) {
	for (i = 0; (s = index234(sktree, i)) != NULL; i++) {
	    p_closesocket(s->s);
	}
	freetree234(sktree);
	sktree = NULL;
    }

    p_WSACleanup();
    if (winsock_module)
	FreeLibrary(winsock_module);
}