From 2b7dd6c2a023186aefe12eaee7d33595379bf4c5 Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 7 Dec 2010 17:01:58 -0500 Subject: [PATCH] Fixed some warnings found by cppcheck --- include/version.sh.c | 4 +++- lang/langcomp.c | 4 ++++ src/config.c | 6 ++++-- src/misc.c | 2 +- src/modules.c | 4 +++- src/modules/extra/atheme2anope/atheme2anope.c | 2 +- src/modules/ns_noop_convert.c | 1 + src/mypasql.c | 3 ++- src/nickserv.c | 3 ++- version.log | 3 ++- 10 files changed, 23 insertions(+), 9 deletions(-) diff --git a/include/version.sh.c b/include/version.sh.c index 0610a8e83..08106d536 100644 --- a/include/version.sh.c +++ b/include/version.sh.c @@ -161,6 +161,8 @@ void write_version(FILE * fd) char buf[1024]; short until_eof = 0; + if (!fdin) + return; while (fgets(buf, 1023, fdin)) { strip(buf); @@ -173,7 +175,7 @@ void write_version(FILE * fd) if (!strcmp(buf, "cat >version.h <nc->flags |= NI_SERVICES_OPER; diff --git a/src/modules/ns_noop_convert.c b/src/modules/ns_noop_convert.c index 24abd0bb7..50c0d4021 100644 --- a/src/modules/ns_noop_convert.c +++ b/src/modules/ns_noop_convert.c @@ -127,6 +127,7 @@ int mLoadData(void) free(name); } } + fclose(in); } return ret; } diff --git a/src/mypasql.c b/src/mypasql.c index a66850c84..50e9d26cf 100644 --- a/src/mypasql.c +++ b/src/mypasql.c @@ -86,15 +86,16 @@ int __stdcall mysql_LoadFromFile(char *file) add_line(&query, line); if (mysql_real_query(mysql, query, strlen(query))) { free(query); + fclose(fd); return 0; } free(query); query = NULL; } - else add_line(&query, line); } + fclose(fd); return 1; } diff --git a/src/nickserv.c b/src/nickserv.c index 3cc58a868..ca1301779 100644 --- a/src/nickserv.c +++ b/src/nickserv.c @@ -1384,7 +1384,7 @@ void insert_core(NickCore * nc) /*************************************************************************/ void insert_requestnick(NickRequest * nr) { - int index = HASH(nr->nick); + int index; if (!nr) { if (debug) { alog("debug: insert_requestnick called with NULL values"); @@ -1392,6 +1392,7 @@ void insert_requestnick(NickRequest * nr) return; } + index = HASH(nr->nick); nr->prev = NULL; nr->next = nrlists[index]; diff --git a/version.log b/version.log index 2b794748e..325d1168c 100644 --- a/version.log +++ b/version.log @@ -8,9 +8,10 @@ VERSION_MAJOR="1" VERSION_MINOR="8" VERSION_PATCH="5" VERSION_EXTRA="-git" -VERSION_BUILD="3046" +VERSION_BUILD="3047" # $Log$ # Changes since 1.8.5 Release +#Revision 3047 - Fixed some warnings found by cppcheck #Revision 3046 - Fixed bug #1202 - Made Anope aware of plexus3's channel mode +z #Revision 3045 - Fixed some improper english in the HOST_GROUP language strings #Revision 3044 - Fixed a potential crash from accessing invalid memory after unbanning people when checking whether a host is akick stuck. Fixes /cs unban not reapplying stuck ban masks.