mirror of
https://github.com/borgbackup/borg.git
synced 2024-12-27 10:18:12 +00:00
cache sync: don't do memcpy(..., 0, 0)
!ctx->buf => ctx->tail - ctx->head == 0
This commit is contained in:
parent
f3f3710279
commit
4490a8bbc3
1 changed files with 4 additions and 2 deletions
|
@ -87,8 +87,10 @@ cache_sync_feed(CacheSyncCtx *ctx, void *data, uint32_t length)
|
||||||
ctx->ctx.user.last_error = "cache_sync_feed: unable to allocate buffer";
|
ctx->ctx.user.last_error = "cache_sync_feed: unable to allocate buffer";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
memcpy(new_buf, ctx->buf + ctx->head, ctx->tail - ctx->head);
|
if(ctx->buf) {
|
||||||
free(ctx->buf);
|
memcpy(new_buf, ctx->buf + ctx->head, ctx->tail - ctx->head);
|
||||||
|
free(ctx->buf);
|
||||||
|
}
|
||||||
ctx->buf = new_buf;
|
ctx->buf = new_buf;
|
||||||
ctx->tail -= ctx->head;
|
ctx->tail -= ctx->head;
|
||||||
ctx->head = 0;
|
ctx->head = 0;
|
||||||
|
|
Loading…
Reference in a new issue