Re: [PATCH v2 07/27] libbtrfsutil: add btrfs_util_subvolume_path()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Feb 23, 2018 at 03:27:52PM +0900, Misono, Tomohiro wrote:
> On 2018/02/16 4:04, Omar Sandoval wrote:
> > From: Omar Sandoval <osandov@xxxxxx>
> 
> > +PUBLIC enum btrfs_util_error btrfs_util_subvolume_path_fd(int fd, uint64_t id,
> > +							  char **path_ret)
> > +{
> > +	char *path, *p;
> > +	size_t capacity = 4096;
> > +
> > +	path = malloc(capacity);
> > +	if (!path)
> > +		return BTRFS_UTIL_ERROR_NO_MEMORY;
> > +	p = path + capacity - 1;
> > +	p[0] = '\0';
> > +
> > +	if (id == 0) {
> > +		enum btrfs_util_error err;
> > +
> > +		err = btrfs_util_is_subvolume_fd(fd);
> > +		if (err)
> > +			return err;
> 
> 'path' should be freed here and below.
> 
> > +
> > +		err = btrfs_util_subvolume_id_fd(fd, &id);
> > +		if (err)
> > +			return err;
> > +	}

Indeed, although I'll just change it to allocate path after this
instead.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux