[CRIU] [PATCHv3 2/2] config: Fix memory initialization
Andrei Vagin
avagin at gmail.com
Thu Jan 24 20:00:46 MSK 2019
On Tue, Jan 22, 2019 at 09:12:40AM +0000, Radostin Stoyanov wrote:
> 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 *));
Why does it have to be initialized?
> if (configuration == NULL) {
> fclose(configfile);
> exit(1);
> --
> 2.20.1
>
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu
More information about the CRIU
mailing list