On Thu, Apr 25, 2013 at 07:37:43PM +0900, MORITA Kazutaka wrote: > +/* update inode with the latest state */ > +static int coroutine_fn reload_vdi_object(BDRVSheepdogState *s) > +{ > + SheepdogInode *inode; > + int ret = 0, fd; > + uint32_t vid; > + > + inode = (SheepdogInode *)g_malloc(sizeof(s->inode)); > + > + fd = connect_to_sdog(s); > + if (fd < 0) { > + ret = -EIO; > + goto out; > + } > + > + ret = find_vdi_name(s, s->name, 0, "", &vid, false); > + if (ret) { > + goto out; > + } > + > + ret = read_object(fd, (char *)inode, vid_to_vdi_oid(vid), > + s->inode.nr_copies, sizeof(*inode), 0, s->cache_flags); > + if (ret < 0) { > + goto out; > + } > + > + if (inode->vdi_id != s->inode.vdi_id) { > + memcpy(&s->inode, inode, sizeof(s->inode)); > + } > + > +out: > + free(inode);
g_malloc() must be paired with g_free(). > + /* link to the pendng list if there is another CoW request to s/pendng/pending/