Fix access violation in ggml_cuda_free_data if tensor->extra is NULL (#4554)

This commit is contained in:
LoganDark 2023-12-21 01:59:27 -08:00 committed by GitHub
parent 799fc22689
commit 1d7a1912ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9091,7 +9091,7 @@ void ggml_cuda_transform_tensor(void * data, struct ggml_tensor * tensor) {
}
void ggml_cuda_free_data(struct ggml_tensor * tensor) {
if (!tensor || (tensor->backend != GGML_BACKEND_GPU && tensor->backend != GGML_BACKEND_GPU_SPLIT) ) {
if (!tensor || !tensor->extra || (tensor->backend != GGML_BACKEND_GPU && tensor->backend != GGML_BACKEND_GPU_SPLIT) ) {
return;
}