diff --git a/src/configfile.c b/src/configfile.c index 51d5faaf..cf5c6b69 100644 --- a/src/configfile.c +++ b/src/configfile.c @@ -176,6 +176,7 @@ int config_read(char *file) { } fclose(fin); + free(buffer); /* fix the fullpath of the web root */ realpath(config.web_root,path_buffer); @@ -211,6 +212,26 @@ int config_read(char *file) { } +/* + * config_close + * + * free up any memory used + */ +void config_close(void) { + CONFIGELEMENT *pce; + int err; + + /* check to see if all required elements are satisfied */ + free(config.configfile); + pce=config_elements; + err=0; + while((pce->config_element != -1)) { + if((pce->config_element) && (pce->type == CONFIG_TYPE_STRING)) + free(*((char**)pce->var)); + pce++; + } +} + /* * config_write * diff --git a/src/configfile.h b/src/configfile.h index d8a80786..df6b4103 100644 --- a/src/configfile.h +++ b/src/configfile.h @@ -31,5 +31,6 @@ extern int config_auth(char *user, char *password); extern void config_handler(WS_CONNINFO *pwsc); extern void config_set_status(WS_CONNINFO *pwsc, int session, char *fmt, ...); extern int config_get_next_session(void); +extern void config_close(void); #endif /* _CONFIGFILE_H_ */