File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -648,6 +648,7 @@ GPUARRAY_PUBLIC void GpuReductionAttr_free (GpuReductionAttr*
648648}
649649GPUARRAY_PUBLIC int GpuReduction_new (GpuReduction * * gr ,
650650 const GpuReductionAttr * grAttr ){
651+ int ret ;
651652 GpuReduction * grOut = NULL ;
652653
653654 if (!gr ){
@@ -665,8 +666,16 @@ GPUARRAY_PUBLIC int GpuReduction_new (GpuReduction**
665666 grOut -> ndd = (int )grAttr -> maxDstDims ;
666667 grOut -> ndr = (int )(grAttr -> maxSrcDims - grAttr -> maxDstDims );
667668
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 ;
669677 }else {
678+ * gr = NULL ;
670679 return GA_MEMORY_ERROR ;
671680 }
672681}
You can’t perform that action at this time.
0 commit comments