Skip to content

Commit bfdb84b

Browse files
blegatmusm
authored andcommitted
Fix segfault due to memcpy (#155)
Fixes failing tests on Linux and OSX
1 parent 9c67743 commit bfdb84b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/mxarray.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ function _copy_sparse_mat(a::SparseMatrixCSC{V,I}, ir_p::Ptr{mwIndex}, jc_p::Ptr
312312
jc[i] = colptr[i] - 1
313313
end
314314

315-
ccall(:memcpy, Ptr{Cvoid}, (Ptr{Cvoid}, Ptr{Cvoid}, UInt), pr_p, v, nnz*sizeof(V))
315+
copyto!(unsafe_wrap(Array, pr_p, (nnz,)), v)
316316
end
317317

318318
function mxarray(a::SparseMatrixCSC{V,I}) where {V<:Union{Float64,Bool},I}

0 commit comments

Comments
 (0)