vbo/dlist: free copied.buffer if no vertices were copied

Other parts of the code asserts that copied.buffer is NULL if there are
no vertices to copy.

Cc: mesa-stable
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13246>
(cherry picked from commit 9b09655a58)
This commit is contained in:
Pierre-Eric Pelloux-Prayer 2021-10-04 11:18:47 +02:00 committed by Eric Engestrom
parent b99dc621ec
commit c88f0087e6
2 changed files with 8 additions and 3 deletions

View file

@ -1696,7 +1696,7 @@
"description": "vbo/dlist: free copied.buffer if no vertices were copied",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null
},

View file

@ -168,8 +168,13 @@ copy_vertices(struct gl_context *ctx,
assert(save->copied.buffer == NULL);
save->copied.buffer = malloc(sizeof(fi_type) * sz * prim->count);
return vbo_copy_vertices(ctx, prim->mode, prim->start, &prim->count,
prim->begin, sz, true, save->copied.buffer, src);
unsigned r = vbo_copy_vertices(ctx, prim->mode, prim->start, &prim->count,
prim->begin, sz, true, save->copied.buffer, src);
if (!r) {
free(save->copied.buffer);
save->copied.buffer = NULL;
}
return r;
}