diff options
Diffstat (limited to 'block')
-rw-r--r-- | block/qed.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/block/qed.c b/block/qed.c index e87dc4decf..7fab155b1a 100644 --- a/block/qed.c +++ b/block/qed.c @@ -1425,8 +1425,10 @@ static int bdrv_qed_change_backing_file(BlockDriverState *bs, memcpy(buffer, &le_header, sizeof(le_header)); buffer_len = sizeof(le_header); - memcpy(buffer + buffer_len, backing_file, backing_file_len); - buffer_len += backing_file_len; + if (backing_file) { + memcpy(buffer + buffer_len, backing_file, backing_file_len); + buffer_len += backing_file_len; + } /* Write new header */ ret = bdrv_pwrite_sync(bs->file, 0, buffer, buffer_len); |