mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Fix ressource leak in client/config.c get_config_entry
The leak happens due to using strndup to create a temporary string without freeing it afterwards. See: https://pagure.io/freeipa/issue/7738 Signed-off-by: Thomas Woerner <twoerner@redhat.com> Reviewed-By: Christian Heimes <cheimes@redhat.com>
This commit is contained in:
committed by
Christian Heimes
parent
5c0885d266
commit
389c17c5c6
@@ -123,17 +123,18 @@ get_config_entry(char * in_data, const char *section, const char *key)
|
||||
line++;
|
||||
p = strchr(line, ']');
|
||||
if (p) {
|
||||
tmp = strndup(line, p - line);
|
||||
if (in_section) {
|
||||
/* We exited the matching section without a match */
|
||||
free(data);
|
||||
return NULL;
|
||||
}
|
||||
tmp = strndup(line, p - line);
|
||||
if (strcmp(section, tmp) == 0) {
|
||||
free(tmp);
|
||||
in_section = 1;
|
||||
continue;
|
||||
}
|
||||
free(tmp);
|
||||
}
|
||||
} /* [ */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user