libsemanage: fix memory leak when setting a custom store_path

A strdup was setting store_path without freeing the original
value in the semanage conf.

Signed-off-by: Yuli Khodorkovskiy <ykhodorkovskiy@tresys.com>
This commit is contained in:
Yuli Khodorkovskiy 2014-04-04 15:28:30 -04:00 committed by Steve Lawrence
parent fa095ad7a1
commit 8b6d00ba72
1 changed files with 1 additions and 0 deletions

View File

@ -319,6 +319,7 @@ void semanage_select_store(semanage_handle_t * sh, char *storename,
/* This just sets the storename to what the user requests, no /* This just sets the storename to what the user requests, no
verification of existance will be done until connect */ verification of existance will be done until connect */
free(sh->conf->store_path);
sh->conf->store_path = strdup(storename); sh->conf->store_path = strdup(storename);
assert(sh->conf->store_path); /* no way to return failure */ assert(sh->conf->store_path); /* no way to return failure */
sh->conf->store_type = storetype; sh->conf->store_type = storetype;