mirror of
https://github.com/owntone/owntone-server.git
synced 2025-01-24 05:03:17 -05:00
Add close function to free up used memory
This commit is contained in:
parent
572a27b9b5
commit
3949902b1b
@ -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
|
||||
*
|
||||
|
@ -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_ */
|
||||
|
Loading…
x
Reference in New Issue
Block a user