Fix a crash and memory leak in get_config_entry()

This commit is contained in:
Martin Nagy authored and Rob Crittenden committed 2010-02-16 10:42:45 -05:00
1 parent 58746226d4
commit a292e9901b
1 file changed
+2 -1
+2 -1
View File
@@ -91,7 +91,7 @@ get_config_entry(char * in_data, const char *section, const char *key)
if (NULL == in_data)
return NULL;
else
strdup(in_data);
data = strdup(in_data);
for (line = strtok_r(data, "\n", &ptr); line != NULL;
line = strtok_r(NULL, "\n", &ptr)) {
@@ -156,5 +156,6 @@ get_config_entry(char * in_data, const char *section, const char *key)
}
}
}
free(data);
return NULL;
}