summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-02-26 21:55:04 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-02-26 21:55:04 +0000
commitf063862950bfa3c5a30f9e6101bd2d74b359b6c0 (patch)
tree62820177f49759bacd86c12bc124a878677e3ade /src
parentda3134547f97127bc92eeac76a9a8dece4a3e07e (diff)
Valgrind fixes
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3353 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/helperfuncs.cpp4
-rw-r--r--src/inspircd_io.cpp8
-rw-r--r--src/mode.cpp4
-rw-r--r--src/socketengine.cpp2
4 files changed, 11 insertions, 7 deletions
diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp
index 6b7178e22..14455ed9b 100644
--- a/src/helperfuncs.cpp
+++ b/src/helperfuncs.cpp
@@ -340,12 +340,12 @@ void WriteTo(userrec *source, userrec *dest,char *data, ...)
}
if (!IS_LOCAL(dest))
return;
- char textbuffer[MAXBUF],tb[MAXBUF];
+ char textbuffer[MAXBUF];
va_list argsPtr;
va_start (argsPtr, data);
vsnprintf(textbuffer, MAXBUF, data, argsPtr);
va_end(argsPtr);
- chop(tb);
+ chop(textbuffer);
// if no source given send it from the server.
if (!source)
diff --git a/src/inspircd_io.cpp b/src/inspircd_io.cpp
index 5e5234635..10eeca525 100644
--- a/src/inspircd_io.cpp
+++ b/src/inspircd_io.cpp
@@ -881,9 +881,10 @@ int ServerConfig::EnumConf(std::stringstream *config, const char* tag)
char buffer[MAXBUF], c_tag[MAXBUF], c, lastc;
int in_token, in_quotes, tptr, idx = 0;
- const char* buf = config->str().c_str();
+ std::string x = config->str();
+ const char* buf = x.c_str();
long bptr = 0;
- long len = strlen(buf);
+ long len = config->str().length();
ptr = 0;
in_token = 0;
@@ -1050,7 +1051,8 @@ int ServerConfig::ReadConf(std::stringstream *config, const char* tag, const cha
int in_token, in_quotes, tptr, idx = 0;
char* key;
- const char* buf = config->str().c_str();
+ std::string x = config->str();
+ const char* buf = x.c_str();
long bptr = 0;
long len = config->str().length();
diff --git a/src/mode.cpp b/src/mode.cpp
index 40ef66f0d..fc2e04b1e 100644
--- a/src/mode.cpp
+++ b/src/mode.cpp
@@ -1675,7 +1675,7 @@ void ModeParser::ServerMode(char **parameters, int pcnt, userrec *user)
if (outpars[0])
{
char b[MAXBUF];
- strlcpy(b,"",MAXBUF);
+ *b = 0;
unsigned int z = 0;
unsigned int i = 0;
while (i < strlen (outpars))
@@ -1707,7 +1707,7 @@ void ModeParser::ServerMode(char **parameters, int pcnt, userrec *user)
if ((!b[0]) || (!strcmp(b,"+")) || (!strcmp(b,"-")))
return;
- if (strcmp(b,""))
+ if (*b)
{
WriteTo(user, dest, "MODE %s :%s", dest->nick, b);
FOREACH_MOD(I_OnMode,OnMode(user, dest, TYPE_USER, b));
diff --git a/src/socketengine.cpp b/src/socketengine.cpp
index ec34bf74e..cec51c5d3 100644
--- a/src/socketengine.cpp
+++ b/src/socketengine.cpp
@@ -86,6 +86,7 @@ bool SocketEngine::AddFd(int fd, bool readable, char type)
log(DEBUG,"Add socket %d",fd);
#ifdef USE_EPOLL
struct epoll_event ev;
+ memset(&ev,0,sizeof(struct epoll_event));
log(DEBUG,"epoll: Add socket to events, ep=%d socket=%d",EngineHandle,fd);
readable ? ev.events = EPOLLIN : ev.events = EPOLLOUT;
ev.data.fd = fd;
@@ -138,6 +139,7 @@ bool SocketEngine::DelFd(int fd)
#endif
#ifdef USE_EPOLL
struct epoll_event ev;
+ memset(&ev,0,sizeof(struct epoll_event));
ref[fd] && X_READBIT ? ev.events = EPOLLIN : ev.events = EPOLLOUT;
ev.data.fd = fd;
int i = epoll_ctl(EngineHandle, EPOLL_CTL_DEL, fd, &ev);