Anonymous avatar Anonymous committed 8095311

Fix some valgrind warnings.

Comments (0)

Files changed (5)

extensions/m_oaccept.c

 	struct Metadata *md;
 	struct DictionaryIter iter;
 	struct Client *target_p;
-	char *text = rb_strdup("");
+	char text[10];
 
 	if(!(target_p = find_client(parv[1])))
 	{
 		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
-	 * with identical OACCEPT entries. */
+	/* Provide a nice error message if you try to OACCEPT someone
+	 * who you've already OACCEPTed. */
 	DICTIONARY_FOREACH(md, &iter, target_p->user->metadata)
 	{
 		if(!strcmp(md->value, "OACCEPT") && !strcmp(md->name, text))

extensions/m_okick.c

 	char *name;
 	char *p = NULL;
 	char *user;
-	char *text = rb_strdup("");
+	char text[10];
 	static char buf[BUFSIZE];
 
 	if(*parv[2] == '\0')
 		      ":%s KICK %s %s :%s", me.id, chptr->chname, who->id, comment);
 	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 */
 	if(MyClient(who) && chptr->mode.mode & MODE_NOREJOIN)

modules/core/m_kick.c

 	char *comment;
 	const char *name;
 	char *p = NULL;
-	char *text = rb_strdup("");
+	char text[10];
 	const char *user;
 	static char buf[BUFSIZE];
 	int is_override = 0;
 			      use_id(source_p), chptr->chname, use_id(who), comment);
 		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 */
 		if(MyClient(who) && chptr->mode.mode & MODE_NOREJOIN)

modules/core/m_message.c

 	struct Metadata *md;
 	struct DictionaryIter iter;
 	int oaccept = 0;
-	char *text3 = rb_strdup("");
+	char text3[10];
 
 	if(MyClient(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)
 				{
 					if(!strcmp(md->value, "OACCEPT") && !strcmp(md->name, text3))
 	char src_host[NICKLEN + USERLEN + HOSTLEN + 6];
 	char src_iphost[NICKLEN + USERLEN + HOSTLEN + 6];
 	char src_althost[NICKLEN + USERLEN + HOSTLEN + 6];
-	char *text = rb_strdup("");
+	char text[10];
 	int use_althost = 0;
 	int i = 0;
 	hook_data_channel moduledata;
 	if((is_banned(chptr, source_p, NULL, src_host, src_iphost)) == CHFL_BAN)
 		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)
 	{
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.