radv: fix possible use-after-free when inserting GS copy shader from cache

If we give radv_pipeline_cache_insert_shaders() a variant which was
retrived from the cache, it will free it.

I haven't encountered this issue, but it seems possible.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <!10433>
67 jobs for !10433 with vk_radv_use_after_free in 23 minutes and 10 seconds (queued for 3 seconds)
latest detached
Status Job ID Name Coverage
  Sanity
passed #9315346
sanity

00:00:09

 
  Container
passed #9315349
aarch64
arm_build

00:00:18

passed #9315350
windows shell 1809 mesa
windows_build_vs2019

00:00:08

passed #9315347
x86_build-base

00:00:14

passed #9315348
x86_test-base

00:00:19

 
  Container 2
passed #9315355
android_build

00:00:17

passed #9315352
i386_build

00:00:18

passed #9315358
kernel+rootfs_amd64

00:00:12

passed #9315359
aarch64
kernel+rootfs_arm64

00:00:56

passed #9315360
aarch64
kernel+rootfs_armhf

00:00:11

passed #9315353
ppc64el_build

00:00:18

passed #9315354
s390x_build

00:00:14

passed #9315351
x86_build

00:00:17

passed #9315356
x86_test-gl

00:00:20

passed #9315357
x86_test-vk

00:00:20

 
  Meson X86 64
passed #9315366
meson-clang

00:04:36

passed #9315367
meson-clover

00:03:05

passed #9315363
meson-clover-testing

00:02:33

passed #9315364
meson-gallium

00:06:35

passed #9315365
meson-release

00:06:09

passed #9315361
meson-testing

00:01:09

passed #9315362
meson-testing-asan

00:03:09

passed #9315368
meson-vulkan

00:02:30

 
  Build Misc
passed #9315369
arm_test

00:00:27

passed #9315370
meson-android

00:01:36

passed #9315372
aarch64
meson-arm64

00:01:30

passed #9315373
aarch64
meson-arm64-asan

00:03:33

passed #9315374
aarch64
meson-arm64-build-test

00:01:28

passed #9315371
aarch64
meson-armhf

00:01:43

passed #9315376
meson-i386

00:01:23

passed #9315379
meson-mingw32-x86_64

00:01:51

passed #9315378
meson-ppc64el

00:02:30

passed #9315377
kvm
meson-s390x

00:03:51

passed #9315375
windows docker 1809 mesa
meson-windows-vs2019

00:05:16

 
  Amd
passed #9315380
radv-fossils

00:07:04

 
  Broadcom
passed #9315381
igalia-rpi4
v3dv-rpi4-vk:armhf 1/6

00:07:28

passed #9315382
igalia-rpi4
v3dv-rpi4-vk:armhf 2/6

00:07:25

passed #9315383
igalia-rpi4
v3dv-rpi4-vk:armhf 3/6

00:07:31

passed #9315384
igalia-rpi4
v3dv-rpi4-vk:armhf 4/6

00:07:19

passed #9315385
igalia-rpi4
v3dv-rpi4-vk:armhf 5/6

00:07:26

passed #9315386
igalia-rpi4
v3dv-rpi4-vk:armhf 6/6

00:07:34

 
  Freedreno
passed #9315387
google-freedreno-db410c
a306_gles2

00:05:51

passed #9315388
google-freedreno-db410c
a306_gles3 1/3

00:09:07

passed #9315389
google-freedreno-db410c
a306_gles3 2/3

00:10:03

passed #9315390
google-freedreno-db410c
a306_gles3 3/3

00:10:10

passed #9315391
google-freedreno-db410c
a306_gles3_options

00:04:55

passed #9315392
google-freedreno-db410c
a306-traces

00:09:11

passed #9315393
google-freedreno-db820c
a530_gles2

00:06:39

passed #9315396
google-freedreno-db820c
a530_gles31 1/2

00:08:41

passed #9315394
google-freedreno-db820c
a530_gles3 1/2

00:09:16

passed #9315397
google-freedreno-db820c
a530_gles31 2/2

00:06:58

passed #9315395
google-freedreno-db820c
a530_gles3 2/2

00:08:03

passed #9315398
google-freedreno-db820c
a530_piglit_gl

00:10:57

passed #9315399
google-freedreno-db820c
a530_piglit_shader

00:09:33

passed #9315400
google-freedreno-db820c
a530-traces

00:14:23

passed #9315405
google-freedreno-cheza
a630_egl

00:02:22

passed #9315404
google-freedreno-cheza
a630_gl

00:01:23

passed #9315401
google-freedreno-cheza
a630_gles2

00:01:32

passed #9315403
google-freedreno-cheza
a630_gles3

00:04:47

passed #9315402
google-freedreno-cheza
a630_gles31

00:04:14

passed #9315406
google-freedreno-cheza
a630_gles_others

00:02:38

passed #9315410
google-freedreno-cheza
a630_piglit

00:09:21

passed #9315411
google-freedreno-cheza
a630-traces

00:06:43

passed #9315407
google-freedreno-cheza
a630_vk 1/2

00:10:46

passed #9315408
google-freedreno-cheza
a630_vk 2/2

00:10:45

passed #9315409
google-freedreno-cheza
a630_vk_sysmem

00:02:13

 
  Layered Backends
passed #9315412
windows docker 1809 mesa
test-d3d12-windows

00:03:11