intel/decoder: Fix memory leak on error path
Fix defect reported by Coverity Scan.
Resource leak (RESOURCE_LEAK)
leaked_storage: Variable text_data going out of scope leaks the storage it points to.
Fixes: b4c8d2dc45
("intel/decoder: Add intel_spec_load_common()")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24659>
This commit is contained in:
@@ -638,8 +638,10 @@ get_embedded_xml_data(int verx10, void **data, size_t *data_len)
|
||||
assert(text_offset + text_length <= total_length);
|
||||
|
||||
*data = malloc(text_length);
|
||||
if (*data == NULL)
|
||||
if (*data == NULL) {
|
||||
free(text_data);
|
||||
return false;
|
||||
}
|
||||
|
||||
memcpy(*data, &text_data[text_offset], text_length);
|
||||
free(text_data);
|
||||
|
Reference in New Issue
Block a user