[lxc-devel] Patch: pivot_root, new version

Cedric Le Goater legoater at free.fr
Wed Jan 6 17:16:11 UTC 2010


2 minor comments on allocations.


> +	/* add entry to list */
> +	listentry = malloc(sizeof(*listentry));
> +	if (!listentry) {
> +		SYSERROR("malloc for mountpoint listentry failed");
> +		return -1;
> +	}
> +	
> +	listentry->elem = strdup(mountpoint);

strdup() can fail.

[ ... ]
  
> +static int config_pivotdir(const char *key, char *value, struct lxc_conf *lxc_conf)
> +{
> +	if (strlen(value)>= MAXPATHLEN) {
> +		ERROR("%s path is too long", value);
> +		return -1;
> +	}
> +
> +	lxc_conf->pivotdir = strdup(value);
> +	if (!lxc_conf->rootfs) {

->pivotdir I suppose ?

cheers,

C.




More information about the lxc-devel mailing list