[NeoStats-Devel] [Commits] r165 - branches/3.0
[email protected] Fri, 13 May 2005 06:15:53 +1000
Newsgroups
gmane.comp.neostats.devel
Message-ID
<[email protected] >
Author: Mark
Date: Fri May 13 04:15:50 2005
New Revision: 165
Modified:
branches/3.0/opsb.c
branches/3.0/proxy.c
Log:
fix memory management calls
Modified: branches/3.0/opsb.c
==============================================================================
--- branches/3.0/opsb.c (original)
+++ branches/3.0/opsb.c Fri May 13 04:15:50 2005
@@ -101,7 +101,7 @@
irc_prefmsg (opsb_bot, cmdparams->source, "Already Scanning (or in queue) %s. Not Scanning again", cmdparams->av[0]);
return NS_SUCCESS;
}
- scandata = malloc( sizeof( scaninfo ) );
+ scandata = ns_malloc( sizeof( scaninfo ) );
scandata->doneban = 0;
scandata->reqclient = cmdparams->source;
scanuser = FindUser( cmdparams->av[0] );
@@ -194,7 +194,7 @@
}
lnode = list_next(opsb.ports, lnode);
}
- pl = malloc(sizeof(port_list));
+ pl = ns_malloc(sizeof(port_list));
pl->type = get_proxy_by_name(cmdparams->av[1]);
pl->port = atoi(cmdparams->av[2]);
@@ -394,7 +394,7 @@
cachenode = list_next(cache, cachenode);
}
- ce = malloc(sizeof(cache_entry));
+ ce = ns_malloc(sizeof(cache_entry));
ce->ip = ip;
ce->when = time(NULL);
lnode_create_append(cache, ce);
@@ -480,7 +480,7 @@
return -1;
}
irc_prefmsg (opsb_bot, cmdparams->source, "%s", opsb.scanmsg);
- scandata = malloc(sizeof(scaninfo));
+ scandata = ns_malloc(sizeof(scaninfo));
scandata->reqclient = NULL;
scandata->doneban = 0;
strlcpy(scandata->who, cmdparams->source->name, MAXHOST);
Modified: branches/3.0/proxy.c
==============================================================================
--- branches/3.0/proxy.c (original)
+++ branches/3.0/proxy.c Fri May 13 04:15:50 2005
@@ -169,7 +169,7 @@
nlog (LOG_WARNING, "Ports list is full.");
break;
}
- prtlst = malloc(sizeof(port_list));
+ prtlst = ns_malloc(sizeof(port_list));
prtlst->type = type;
prtlst->port = atoi(av[j]);
prtlst->noopen = 0;
@@ -252,7 +252,7 @@
pn = list_first(opsb.ports);
while (pn) {
pl = lnode_get(pn);
- ci = malloc(sizeof(conninfo));
+ ci = ns_malloc(sizeof(conninfo));
ci->type = pl->type;
ci->port = pl->port;
ci->scandata = scandata;
@@ -261,7 +261,7 @@
if (proxy_list[i].type == pl->type) {
if ((ci->fd = sock_connect(SOCK_STREAM, scandata->ip, ci->port)) == NS_FAILURE) {
nlog(LOG_WARNING, "start_proxy_scan(): Failed Connect for protocol %s on port %d", type_of_proxy(ci->type), ci->port);
- free(ci);
+ ns_free(ci);
pn = list_next(opsb.ports, pn);
continue;
}
@@ -270,7 +270,7 @@
if (( ci->sock = AddSock(SOCK_STANDARD, tmpname, ci->fd, proxy_read, proxy_list[i].writefunc, EV_WRITE|EV_READ|EV_TIMEOUT|EV_PERSIST, ci, &tv)) == NULL) {
nlog(LOG_WARNING, "start_proxy_scan(): Failed AddSock for protocol %s on port %d", type_of_proxy(ci->type), ci->port);
os_sock_close(ci->fd);
- free(ci);
+ ns_free(ci);
pn = list_next(opsb.ports, pn);
continue;
}
@@ -379,7 +379,7 @@
list_delete(si->connections, connode);
lnode_destroy(connode);
if (si->reqclient) irc_prefmsg(opsb_bot, si->reqclient, "Connection on %s (%s:%d) for Protocol %s Closed", si->who, si->lookup, ci->port, type_of_proxy(ci->type));
- free(ci);
+ ns_free(ci);
}
if (list_count(si->connections) == 0) {
if (si->state == DOING_SCAN) si->state = FIN_SCAN;