Revision ea80b906 block/qcow2.c

b/block/qcow2.c
677 677
     * EOF). Extend the image to the last allocated sector.
678 678
     */
679 679
    if (cluster_offset != 0) {
680
        bdrv_truncate(s->hd, cluster_offset + (num <<  9));
680
        uint8_t buf[512];
681
        memset(buf, 0, 512);
682
        bdrv_write(s->hd, (cluster_offset >> 9) + num - 1, buf, 1);
681 683
    }
682 684

  
683 685
    return 0;

Also available in: Unified diff