We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c679474 commit ecde75cCopy full SHA for ecde75c
1 file changed
src/gpuarray_reduction.c
@@ -648,6 +648,7 @@ GPUARRAY_PUBLIC void GpuReductionAttr_free (GpuReductionAttr*
648
}
649
GPUARRAY_PUBLIC int GpuReduction_new (GpuReduction** gr,
650
const GpuReductionAttr* grAttr){
651
+ int ret;
652
GpuReduction* grOut = NULL;
653
654
if (!gr){
@@ -665,8 +666,16 @@ GPUARRAY_PUBLIC int GpuReduction_new (GpuReduction**
665
666
grOut->ndd = (int)grAttr->maxDstDims;
667
grOut->ndr = (int)(grAttr->maxSrcDims - grAttr->maxDstDims);
668
- return reduxGenInit(grOut);
669
+ ret = reduxGenInit(grOut);
670
+ if(ret == GA_NO_ERROR){
671
+ *gr = grOut;
672
+ }else{
673
+ GpuReduction_free(grOut);
674
+ *gr = NULL;
675
+ }
676
+ return ret;
677
}else{
678
679
return GA_MEMORY_ERROR;
680
681
0 commit comments