diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/config.c | 6 | ||||
-rw-r--r-- | src/misc.c | 2 | ||||
-rw-r--r-- | src/modules.c | 4 | ||||
-rw-r--r-- | src/modules/extra/atheme2anope/atheme2anope.c | 2 | ||||
-rw-r--r-- | src/modules/ns_noop_convert.c | 1 | ||||
-rw-r--r-- | src/mypasql.c | 3 | ||||
-rw-r--r-- | src/nickserv.c | 3 |
7 files changed, 14 insertions, 7 deletions
diff --git a/src/config.c b/src/config.c index 793b608e6..5bd1cf2bd 100644 --- a/src/config.c +++ b/src/config.c @@ -926,7 +926,9 @@ int read_config(int reload) perror("Can't open " SERVICES_CONF); else alog("Can't open %s", SERVICES_CONF); +#ifndef NOT_MAIN } +#endif return 0; } while (fgets(buf, sizeof(buf), config)) { @@ -1246,7 +1248,7 @@ int read_config(int reload) if (s) { RootNumber++; ServicesRoots = - realloc(ServicesRoots, sizeof(char *) * RootNumber); + srealloc(ServicesRoots, sizeof(char *) * RootNumber); ServicesRoots[RootNumber - 1] = sstrdup(s); } } while ((s = strtok(NULL, " "))); @@ -1266,7 +1268,7 @@ int read_config(int reload) do { if (s) { NumUlines++; - Ulines = realloc(Ulines, sizeof(char *) * NumUlines); + Ulines = srealloc(Ulines, sizeof(char *) * NumUlines); Ulines[NumUlines - 1] = sstrdup(s); } } while ((s = strtok(NULL, " "))); diff --git a/src/misc.c b/src/misc.c index f51c2697c..488d028e3 100644 --- a/src/misc.c +++ b/src/misc.c @@ -1221,7 +1221,7 @@ char **buildStringList(char *src, int *number) do { if (s) { i++; - list = realloc(list, sizeof(char *) * i); + list = srealloc(list, sizeof(char *) * i); list[i - 1] = sstrdup(s); } } while ((s = strtok(NULL, " "))); diff --git a/src/modules.c b/src/modules.c index 7e7061647..ab3352ac8 100644 --- a/src/modules.c +++ b/src/modules.c @@ -537,7 +537,7 @@ int moduleCopyFile(char *name, char *output) int ch; FILE *source, *target; int srcfp; - char input[4096]; + char input[4096] = ""; int len; strncpy(input, MODULE_PATH, 4095); /* Get full path with module extension */ @@ -562,6 +562,7 @@ int moduleCopyFile(char *name, char *output) */ #ifndef _WIN32 if ((source = fopen(input, "r")) == NULL) { + close(srcfp); #else if ((source = fopen(input, "rb")) == NULL) { #endif @@ -572,6 +573,7 @@ int moduleCopyFile(char *name, char *output) #else if ((target = fopen(output, "wb")) == NULL) { #endif + fclose(source); return MOD_ERR_FILE_IO; } while ((ch = fgetc(source)) != EOF) { diff --git a/src/modules/extra/atheme2anope/atheme2anope.c b/src/modules/extra/atheme2anope/atheme2anope.c index 49cbc1b1e..c0b4804ce 100644 --- a/src/modules/extra/atheme2anope/atheme2anope.c +++ b/src/modules/extra/atheme2anope/atheme2anope.c @@ -232,7 +232,7 @@ void WriteNick(char *line) } } } - else if (!strcmp(tok, "SO")) + else if (na && !strcmp(tok, "SO")) { tok = strtok(NULL, " "); na->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]; |