1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2025-02-20 21:27:32 +00:00

Merge pull request #2670 from enkore/f/fcs-playnice

cache sync: don't do memcpy(..., 0, 0)
This commit is contained in:
enkore 2017-06-13 13:13:06 +02:00 committed by GitHub
commit 6ce7b9505c

View file

@ -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";
return 0;
}
memcpy(new_buf, ctx->buf + ctx->head, ctx->tail - ctx->head);
free(ctx->buf);
if(ctx->buf) {
memcpy(new_buf, ctx->buf + ctx->head, ctx->tail - ctx->head);
free(ctx->buf);
}
ctx->buf = new_buf;
ctx->tail -= ctx->head;
ctx->head = 0;