Fix some valgrind warnings.

This commit is contained in:
B.Greenham 2010-05-27 18:03:51 -04:00
parent 1add004b97
commit 2498a1b577
5 changed files with 12 additions and 12 deletions

View File

@ -23,7 +23,7 @@ mo_oaccept(struct Client *client_p, struct Client *source_p, int parc, const cha
struct Metadata *md; struct Metadata *md;
struct DictionaryIter iter; struct DictionaryIter iter;
struct Client *target_p; struct Client *target_p;
char *text = rb_strdup(""); char text[10];
if(!(target_p = find_client(parv[1]))) if(!(target_p = find_client(parv[1])))
{ {
@ -31,10 +31,10 @@ mo_oaccept(struct Client *client_p, struct Client *source_p, int parc, const cha
return 0; return 0;
} }
rb_sprintf(text, "O%s", source_p->id); rb_snprintf(text, sizeof(text), "O%s", source_p->id);
/* Don't allow someone to pointlessly fill up someone's metadata /* Provide a nice error message if you try to OACCEPT someone
* with identical OACCEPT entries. */ * who you've already OACCEPTed. */
DICTIONARY_FOREACH(md, &iter, target_p->user->metadata) DICTIONARY_FOREACH(md, &iter, target_p->user->metadata)
{ {
if(!strcmp(md->value, "OACCEPT") && !strcmp(md->name, text)) if(!strcmp(md->value, "OACCEPT") && !strcmp(md->name, text))

View File

@ -68,7 +68,7 @@ mo_okick(struct Client *client_p, struct Client *source_p, int parc, const char
char *name; char *name;
char *p = NULL; char *p = NULL;
char *user; char *user;
char *text = rb_strdup(""); char text[10];
static char buf[BUFSIZE]; static char buf[BUFSIZE];
if(*parv[2] == '\0') if(*parv[2] == '\0')
@ -138,7 +138,7 @@ mo_okick(struct Client *client_p, struct Client *source_p, int parc, const char
":%s KICK %s %s :%s", me.id, chptr->chname, who->id, comment); ":%s KICK %s %s :%s", me.id, chptr->chname, who->id, comment);
remove_user_from_channel(msptr); remove_user_from_channel(msptr);
rb_sprintf(text, "K%s", who->id); rb_snprintf(text, sizeof(text), "K%s", who->id);
/* we don't need to track NOREJOIN stuff unless it's our client being kicked */ /* we don't need to track NOREJOIN stuff unless it's our client being kicked */
if(MyClient(who) && chptr->mode.mode & MODE_NOREJOIN) if(MyClient(who) && chptr->mode.mode & MODE_NOREJOIN)

View File

@ -68,7 +68,7 @@ m_kick(struct Client *client_p, struct Client *source_p, int parc, const char *p
char *comment; char *comment;
const char *name; const char *name;
char *p = NULL; char *p = NULL;
char *text = rb_strdup(""); char text[10];
const char *user; const char *user;
static char buf[BUFSIZE]; static char buf[BUFSIZE];
int is_override = 0; int is_override = 0;
@ -235,7 +235,7 @@ m_kick(struct Client *client_p, struct Client *source_p, int parc, const char *p
use_id(source_p), chptr->chname, use_id(who), comment); use_id(source_p), chptr->chname, use_id(who), comment);
remove_user_from_channel(msptr); remove_user_from_channel(msptr);
rb_sprintf(text, "K%s", who->id); rb_snprintf(text, sizeof(text), "K%s", who->id);
/* we don't need to track NOREJOIN stuff unless it's our client being kicked */ /* we don't need to track NOREJOIN stuff unless it's our client being kicked */
if(MyClient(who) && chptr->mode.mode & MODE_NOREJOIN) if(MyClient(who) && chptr->mode.mode & MODE_NOREJOIN)

View File

@ -733,7 +733,7 @@ msg_client(int p_or_n, const char *command,
struct Metadata *md; struct Metadata *md;
struct DictionaryIter iter; struct DictionaryIter iter;
int oaccept = 0; int oaccept = 0;
char *text3 = rb_strdup(""); char text3[10];
if(MyClient(source_p)) if(MyClient(source_p))
{ {
@ -796,7 +796,7 @@ msg_client(int p_or_n, const char *command,
{ {
if (IsOper(source_p)) if (IsOper(source_p))
{ {
rb_sprintf(text3, "O%s", source_p->id); rb_snprintf(text3, sizeof(text3), "O%s", source_p->id);
DICTIONARY_FOREACH(md, &iter, target_p->user->metadata) DICTIONARY_FOREACH(md, &iter, target_p->user->metadata)
{ {
if(!strcmp(md->value, "OACCEPT") && !strcmp(md->name, text3)) if(!strcmp(md->value, "OACCEPT") && !strcmp(md->name, text3))

View File

@ -826,7 +826,7 @@ can_join(struct Client *source_p, struct Channel *chptr, char *key)
char src_host[NICKLEN + USERLEN + HOSTLEN + 6]; char src_host[NICKLEN + USERLEN + HOSTLEN + 6];
char src_iphost[NICKLEN + USERLEN + HOSTLEN + 6]; char src_iphost[NICKLEN + USERLEN + HOSTLEN + 6];
char src_althost[NICKLEN + USERLEN + HOSTLEN + 6]; char src_althost[NICKLEN + USERLEN + HOSTLEN + 6];
char *text = rb_strdup(""); char text[10];
int use_althost = 0; int use_althost = 0;
int i = 0; int i = 0;
hook_data_channel moduledata; hook_data_channel moduledata;
@ -857,7 +857,7 @@ can_join(struct Client *source_p, struct Channel *chptr, char *key)
if((is_banned(chptr, source_p, NULL, src_host, src_iphost)) == CHFL_BAN) if((is_banned(chptr, source_p, NULL, src_host, src_iphost)) == CHFL_BAN)
return (ERR_BANNEDFROMCHAN); return (ERR_BANNEDFROMCHAN);
rb_sprintf(text, "K%s", source_p->id); rb_snprintf(text, sizeof(text), "K%s", source_p->id);
DICTIONARY_FOREACH(md, &iter, chptr->metadata) DICTIONARY_FOREACH(md, &iter, chptr->metadata)
{ {