Skip to content

Commit 82b554e

Browse files
Patrick Lerdadcbaker-intel
authored andcommitted
r600: fix shader blob memory leak
Fixes: 5b205ef r600: Store nir shaders serialized to save memory Direct leak of 4096 byte(s) in 1 object(s) allocated from: #0 0x7faf89c3bb48 in __interceptor_realloc (/usr/lib64/libasan.so.6+0xb1b48) android-rpi#1 0x7faf7be5981d in grow_to_fit ../src/util/blob.c:67 android-rpi#2 0x7faf7be5a538 in grow_to_fit ../src/util/blob.c:49 android-rpi#3 0x7faf7be5a538 in blob_reserve_bytes ../src/util/blob.c:177 #4 0x7faf7be5a538 in blob_reserve_uint32 ../src/util/blob.c:190 #5 0x7faf7d248a8c in nir_serialize ../src/compiler/nir/nir_serialize.c:2109 #6 0x7faf7df4fdbb in r600_pipe_shader_create ../src/gallium/drivers/r600/r600_shader.c:401 Signed-off-by: Patrick Lerda <[email protected]> Reviewed-by: Gert Wollny <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21443> (cherry picked from commit 9b4eb73)
1 parent 713ee4a commit 82b554e

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

.pick_status.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@
139139
"description": "r600: fix shader blob memory leak",
140140
"nominated": true,
141141
"nomination_type": 1,
142-
"resolution": 0,
142+
"resolution": 1,
143143
"main_sha": null,
144144
"because_sha": "5b205ef41307406983ffac829ae423d08f7527bc"
145145
},

src/gallium/drivers/r600/r600_shader.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,7 @@ int r600_pipe_shader_create(struct pipe_context *ctx,
402402
sel->nir_blob = malloc(blob.size);
403403
memcpy(sel->nir_blob, blob.data, blob.size);
404404
sel->nir_blob_size = blob.size;
405+
blob_finish(&blob);
405406
}
406407
ralloc_free(sel->nir);
407408
sel->nir = NULL;

0 commit comments

Comments
 (0)