1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-11-15 17:47:09 +00:00

Fix memleak when there is no config available

The 'buf' string in current_config() got allocated but not deleted when
CRIT_ERR stops the program.
This commit is contained in:
Nikolas Garofil 2010-10-24 17:57:58 +02:00
parent 56ddea77a8
commit 11e5db2132

View File

@ -4155,11 +4155,12 @@ void set_current_config() {
FILE *fp;
/* Try to use personal config file first */
std::string buf = to_real_path(CONFIG_FILE);
if (!buf.empty() && (fp = fopen(buf.c_str(), "r"))) {
current_config = buf;
std::string *buf = new std::string(to_real_path(CONFIG_FILE));
if (!buf->empty() && (fp = fopen(buf->c_str(), "r"))) {
current_config = buf->c_str();
fclose(fp);
}
delete buf;
/* Try to use system config file if personal config not readable */
if (current_config.empty() && (fp = fopen(SYSTEM_CONFIG_FILE, "r"))) {