mirror of
https://github.com/pgvector/pgvector.git
synced 2026-07-11 07:06:57 +08:00
Improved safety check [skip ci]
This commit is contained in:
@@ -898,13 +898,13 @@ sparsevec_l2_normalize(PG_FUNCTION_ARGS)
|
|||||||
if (rx[i] == 0)
|
if (rx[i] == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
newResult->indices[j] = result->indices[i];
|
|
||||||
nx[j] = rx[i];
|
|
||||||
j++;
|
|
||||||
|
|
||||||
/* Safety check */
|
/* Safety check */
|
||||||
if (j == newResult->nnz)
|
if (j == newResult->nnz)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
newResult->indices[j] = result->indices[i];
|
||||||
|
nx[j] = rx[i];
|
||||||
|
j++;
|
||||||
}
|
}
|
||||||
|
|
||||||
pfree(result);
|
pfree(result);
|
||||||
|
|||||||
Reference in New Issue
Block a user