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>
This commit is contained in:
Pierre-Eric Pelloux-Prayer
2021-10-04 11:18:47 +02:00
parent 118f2952b6
commit 9b09655a58
+7 -2
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;
}