[CRIU] [PATCH] irmap: don't leak irmap objects in --irmap-scan-path

Pavel Emelyanov xemul at parallels.com
Tue Sep 22 11:47:07 PDT 2015


> @@ -268,9 +268,14 @@ char *irmap_lookup(unsigned int s_dev, unsigned long i_ino)
>  	list_for_each_entry(o, &opts.irmap_scan_paths, node) {
>  		struct irmap *ir;
>  
> -		ir = xzalloc(sizeof(*ir));
> -		if (!ir)
> -			goto out;
> +		if (!o->ir) {
> +			ir = xzalloc(sizeof(*ir));
> +			if (!ir)
> +				goto out;
> +			o->ir = ir;
> +		} else {
> +			ir = o->ir;

OK, and since we keep the ir on o all the time, is there any reason why
we don't embed the struct irmap directly into the struct irmap_path_opt? :)

> +		}
>  
>  		ir->nr_kids = -1;
>  		ir->path = o->path;



More information about the CRIU mailing list