[CRIU] [PATCH 2/2] config: Don't free memory in PARSING_USER_CONF

Radostin Stoyanov rstoyanov1 at gmail.com
Sat Jan 19 20:23:14 MSK 2019


On restore, when state=PARSING_USER_CONF the _argv pointer
points to the location which contains the envirnment variables
and should not be free()-ed.

Signed-off-by: Radostin Stoyanov <rstoyanov1 at gmail.com>
---
 criu/config.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/criu/config.c b/criu/config.c
index 89afdd748..f3c8d4254 100644
--- a/criu/config.c
+++ b/criu/config.c
@@ -509,7 +509,7 @@ int parse_options(int argc, char **argv, bool *usage_error,
 		/* Only if opt is -1 we are going to the next configuration input */
 		if (opt == -1) {
 			/* Do not free any memory if it points to argv */
-			if (state != PARSING_ARGV + 1) {
+			if (state != PARSING_ARGV + 1 && state != PARSING_USER_CONF) {
 				int i;
 				for (i=1; i < _argc; i++) {
 					free(_argv[i]);
-- 
2.20.1



More information about the CRIU mailing list