Add close function to free up used memory

This commit is contained in:
Ron Pedde 2003-11-23 18:14:40 +00:00
parent 572a27b9b5
commit 3949902b1b
2 changed files with 22 additions and 0 deletions

View File

@ -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
*

View File

@ -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_ */