Skip to content

Commit 3cef2c9

Browse files
authored
Merge pull request #484 from abergeron/fix_segv
Avoid a segfault the the copy errors out.
2 parents e0b4420 + e2a43c5 commit 3cef2c9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/gpuarray_array.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,8 @@ int GpuArray_reshape(GpuArray *res, const GpuArray *a, unsigned int nd,
643643
err = GpuArray_reshape_inplace(res, nd, newdims, ord);
644644
if (err == GA_COPY_ERROR && !nocopy) {
645645
GpuArray_clear(res);
646-
GpuArray_copy(res, a, ord);
646+
err = GpuArray_copy(res, a, ord);
647+
if (err != GA_NO_ERROR) return err;
647648
err = GpuArray_reshape_inplace(res, nd, newdims, ord);
648649
}
649650
if (err != GA_NO_ERROR) GpuArray_clear(res);

0 commit comments

Comments
 (0)