conf: unmap on errors

This commit is contained in:
Wim Taymans 2024-03-27 15:50:25 +01:00
parent d4581755e6
commit 6bdeeb5881
1 changed files with 5 additions and 1 deletions

View File

@ -385,7 +385,7 @@ int pw_conf_save_state(const char *prefix, const char *name, const struct pw_pro
static int conf_load(const char *path, struct pw_properties *conf)
{
char *data = NULL;
char *data = MAP_FAILED;
struct stat sbuf;
int count;
struct spa_error_location loc = { 0 };
@ -423,6 +423,10 @@ error:
"%p: error in config '%s': %s", conf, path, loc.reason);
else
pw_log_warn("%p: error loading config '%s': %m", conf, path);
if (data != MAP_FAILED)
munmap(data, sbuf.st_size);
return res;
}