@@ -129,6 +129,7 @@ func (ptr *resultBool) destroy() {
129129 if ptr != nil {
130130 // TODO: correct naming
131131 C .destroy_verify_seal_response (ptr )
132+ ptr = nil
132133 }
133134}
134135
@@ -139,12 +140,14 @@ func (ptr *PoStProof) registeredProof() RegisteredPoStProof {
139140func (ptr * PoStProof ) destroy () {
140141 if ptr != nil {
141142 ptr .proof .Destroy ()
143+ ptr = nil
142144 }
143145}
144146
145147func (ptr * ByteArray96 ) destroy () {
146148 if ptr != nil {
147149 C .destroy_box_bls_digest (ptr )
150+ ptr = nil
148151 }
149152}
150153
@@ -177,6 +180,7 @@ func (ptr *ByteArray48) copyAsArray() *[48]byte {
177180func (ptr * ByteArray48 ) destroy () {
178181 if ptr != nil {
179182 C .destroy_box_bls_public_key (ptr )
183+ ptr = nil
180184 }
181185}
182186
@@ -204,6 +208,7 @@ func (ptr *ByteArray32) copyAsArray() *[32]byte {
204208func (ptr * ByteArray32 ) destroy () {
205209 if ptr != nil {
206210 C .destroy_box_bls_private_key (ptr )
211+ ptr = nil
207212 }
208213}
209214
@@ -218,6 +223,7 @@ func (ptr *resultGeneratePieceCommitment) errorMsg() *SliceBoxedUint8 {
218223func (ptr * resultGeneratePieceCommitment ) destroy () {
219224 if ptr != nil {
220225 C .destroy_generate_piece_commitment_response (ptr )
226+ ptr = nil
221227 }
222228}
223229
@@ -233,6 +239,7 @@ func (ptr *resultByteArray32) destroy() {
233239 if ptr != nil {
234240 // TODO: better naming
235241 C .destroy_generate_data_commitment_response (ptr )
242+ ptr = nil
236243 }
237244}
238245
@@ -247,6 +254,7 @@ func (ptr *resultWriteWithAlignment) errorMsg() *SliceBoxedUint8 {
247254func (ptr * resultWriteWithAlignment ) destroy () {
248255 if ptr != nil {
249256 C .destroy_write_with_alignment_response (ptr )
257+ ptr = nil
250258 }
251259}
252260
@@ -261,6 +269,7 @@ func (ptr *resultWriteWithoutAlignment) errorMsg() *SliceBoxedUint8 {
261269func (ptr * resultWriteWithoutAlignment ) destroy () {
262270 if ptr != nil {
263271 C .destroy_write_without_alignment_response (ptr )
272+ ptr = nil
264273 }
265274}
266275
@@ -276,6 +285,7 @@ func (ptr *resultSliceBoxedUint8) destroy() {
276285 if ptr != nil {
277286 // TODO: naming
278287 C .destroy_seal_pre_commit_phase1_response (ptr )
288+ ptr = nil
279289 }
280290}
281291
@@ -290,6 +300,7 @@ func (ptr *resultSealPreCommitPhase2) errorMsg() *SliceBoxedUint8 {
290300func (ptr * resultSealPreCommitPhase2 ) destroy () {
291301 if ptr != nil {
292302 C .destroy_seal_pre_commit_phase2_response (ptr )
303+ ptr = nil
293304 }
294305}
295306
@@ -305,6 +316,7 @@ func (ptr *resultVoid) destroy() {
305316 if ptr != nil {
306317 // TODO: correct naming
307318 C .destroy_unseal_range_response (ptr )
319+ ptr = nil
308320 }
309321}
310322
@@ -334,6 +346,7 @@ func (ptr *resultSliceBoxedUint64) destroy() {
334346 if ptr != nil {
335347 // TODO: correct naming
336348 C .destroy_generate_winning_post_sector_challenge (ptr )
349+ ptr = nil
337350 }
338351}
339352
@@ -374,6 +387,7 @@ func (ptr *resultSliceBoxedPoStProof) destroy() {
374387 if ptr != nil {
375388 // TODO: correct naming
376389 C .destroy_generate_winning_post_response (ptr )
390+ ptr = nil
377391 }
378392}
379393
@@ -388,6 +402,7 @@ func (ptr *resultGenerateWindowPoSt) errorMsg() *SliceBoxedUint8 {
388402func (ptr * resultGenerateWindowPoSt ) destroy () {
389403 if ptr != nil {
390404 C .destroy_generate_window_post_response (ptr )
405+ ptr = nil
391406 }
392407}
393408
@@ -434,6 +449,7 @@ func (ptr *resultSliceBoxedSliceBoxedUint8) destroy() {
434449 if ptr != nil {
435450 // TODO: naming
436451 C .destroy_generate_empty_sector_update_partition_proof_response (ptr )
452+ ptr = nil
437453 }
438454}
439455
@@ -449,6 +465,7 @@ func (ptr *resultUint) destroy() {
449465 if ptr != nil {
450466 // TODO: naming
451467 C .destroy_get_num_partition_for_fallback_post_response (ptr )
468+ ptr = nil
452469 }
453470}
454471
@@ -463,6 +480,7 @@ func (ptr *resultEmptySectorUpdateEncodeInto) errorMsg() *SliceBoxedUint8 {
463480func (ptr * resultEmptySectorUpdateEncodeInto ) destroy () {
464481 if ptr != nil {
465482 C .destroy_empty_sector_update_encode_into_response (ptr )
483+ ptr = nil
466484 }
467485}
468486
@@ -495,6 +513,7 @@ func (ptr *resultGenerateFallbackSectorChallenges) errorMsg() *SliceBoxedUint8 {
495513func (ptr * resultGenerateFallbackSectorChallenges ) destroy () {
496514 if ptr != nil {
497515 C .destroy_generate_fallback_sector_challenges_response (ptr )
516+ ptr = nil
498517 }
499518}
500519
@@ -516,6 +535,7 @@ func (ptr *resultGenerateSingleWindowPoStWithVanilla) errorMsg() *SliceBoxedUint
516535func (ptr * resultGenerateSingleWindowPoStWithVanilla ) destroy () {
517536 if ptr != nil {
518537 C .destroy_generate_single_window_post_with_vanilla_response (ptr )
538+ ptr = nil
519539 }
520540}
521541
@@ -530,19 +550,22 @@ func (ptr *resultPoStProof) errorMsg() *SliceBoxedUint8 {
530550func (ptr * resultPoStProof ) destroy () {
531551 if ptr != nil {
532552 C .destroy_merge_window_post_partition_proofs_response (ptr )
553+ ptr = nil
533554 }
534555}
535556
536557func (ptr SliceBoxedUint8 ) Destroy () {
537558 if ptr .ptr != nil {
538559 C .destroy_boxed_slice (ptr )
560+ ptr .ptr = nil
539561 }
540562}
541563
542564func (ptr * PrivateReplicaInfo ) Destroy () {
543565 if ptr != nil {
544566 ptr .cache_dir_path .Destroy ()
545567 ptr .replica_path .Destroy ()
568+ ptr = nil
546569 }
547570}
548571
@@ -557,6 +580,7 @@ func (ptr *resultFvmMachineExecuteResponse) errorMsg() *SliceBoxedUint8 {
557580func (ptr * resultFvmMachineExecuteResponse ) destroy () {
558581 if ptr != nil {
559582 C .destroy_fvm_machine_execute_response (ptr )
583+ ptr = nil
560584 }
561585}
562586
@@ -571,12 +595,14 @@ func (ptr *resultFvmMachine) errorMsg() *SliceBoxedUint8 {
571595func (ptr * resultFvmMachine ) destroy () {
572596 if ptr != nil {
573597 C .destroy_create_fvm_machine_response (ptr )
598+ ptr = nil
574599 }
575600}
576601
577602func (ptr * FvmMachine ) Destroy () {
578603 if ptr != nil {
579604 C .drop_fvm_machine (ptr )
605+ ptr = nil
580606 }
581607}
582608
0 commit comments