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 <osan...@fb.com>
> 
> > +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 majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to