X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=src%2FConfigParser.c;fp=src%2FConfigParser.c;h=061e2488d34d35c7fd66bf21c09292dd42554572;hb=b2d36921d551c63c612e2926b38dd09d55c36dea;hp=775e062fef399dc4385bd2c06e3e9499d9a48cb1;hpb=8e1495c30d7a78bbf3c66452ef2b8804d59e1b42;p=NeonServV5.git diff --git a/src/ConfigParser.c b/src/ConfigParser.c index 775e062..061e248 100644 --- a/src/ConfigParser.c +++ b/src/ConfigParser.c @@ -46,13 +46,21 @@ int loadConfig(const char *filename) { // allocate memory to contain the whole file: char *buffer = (char*) malloc (sizeof(char)*lSize + 1); - if (buffer == NULL) return 0; + if (buffer == NULL) { + fclose(f); + return 0; + } // copy the file into the buffer: size_t result = fread (buffer, 1, lSize, f); - if (result != lSize) return 0; + if (result != lSize) { + fclose(f); + return 0; + } buffer[lSize] = '\0'; + fclose(f); + // now parse the config file... if(root_entry) { free_loaded_config();