[CRIU] [PATCHv3 2/2] config: Fix memory initialization

Radostin Stoyanov rstoyanov1 at gmail.com
Tue Jan 22 12:12:40 MSK 2019


Initialize allocated memory when parsing configuration file.

v3: Use calloc() instead of malloc() followed by memset()

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..a0bfae10a 100644
--- a/criu/config.c
+++ b/criu/config.c
@@ -54,7 +54,7 @@ static char ** parse_config(char *filepath)
 	if (!configfile) {
 		return NULL;
 	}
-	configuration = xmalloc(config_size * sizeof(char *));
+	configuration = xzalloc(config_size * sizeof(char *));
 	if (configuration == NULL) {
 		fclose(configfile);
 		exit(1);
-- 
2.20.1



More information about the CRIU mailing list