vrend: fix memory leak in vrend_decode_create_ve

Free vertex element in error path.
This was introduced by this commit:
vrend: add sanity check for vertext buffer index.

Reported-by: Matthias Gerstner <mgerstner@suse.de>
Signed-off-by: Li Qiang <liq3ea@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
macos/master
Li Qiang 8 years ago committed by Dave Airlie
parent 76b3da97b5
commit affd94f7e5
  1. 4
      src/vrend_decode.c

@ -613,8 +613,10 @@ static int vrend_decode_create_ve(struct vrend_decode_ctx *ctx, uint32_t handle,
ve[i].instance_divisor = get_buf_entry(ctx, VIRGL_OBJ_VERTEX_ELEMENTS_V0_INSTANCE_DIVISOR(i));
ve[i].vertex_buffer_index = get_buf_entry(ctx, VIRGL_OBJ_VERTEX_ELEMENTS_V0_VERTEX_BUFFER_INDEX(i));
if (ve[i].vertex_buffer_index >= PIPE_MAX_ATTRIBS)
if (ve[i].vertex_buffer_index >= PIPE_MAX_ATTRIBS) {
FREE(ve);
return EINVAL;
}
ve[i].src_format = get_buf_entry(ctx, VIRGL_OBJ_VERTEX_ELEMENTS_V0_SRC_FORMAT(i));
}

Loading…
Cancel
Save