[QNNPACK] Fix Memory Leak in QNNPACK QSoftmax Op (#89544)
Summary:
The deleter of the operator's unique_ptr doesn't get called unless the unique_ptr is created after the op has been created
This fixes the problem reported in
https://fb.workplace.com/groups/pytorch.edge.users/posts/1210708329799458/
Test Plan:
# Testing memory leak fix
**With test code added in D41487340:**
```
cd ~/fbsource/xplat
buck run caffe2/aten/src/ATen/native/quantized/cpu/qsoftmax_test:qsoftmax_test
```
Before this diff:
```
==2060866==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 608 byte(s) in 1 object(s) allocated from:
#0 0x41bcd27 in calloc (/data/users/salilsdesai/fbsource/buck-out/gen/aab7ed39/xplat/caffe2/aten/src/ATen/native/quantized/cpu/qsoftmax_test/qsoftmax_test+0x41bcd27)
#1 0x405b692 in pytorch_qnnp_create_softargmax_nc_q8 xplat/caffe2/aten/src/ATen/native/quantized/cpu/qnnpack/src/softargmax.c:77
Indirect leak of 1024 byte(s) in 1 object(s) allocated from:
#0 0x41bcb7f in malloc (/data/users/salilsdesai/fbsource/buck-out/gen/aab7ed39/xplat/caffe2/aten/src/ATen/native/quantized/cpu/qsoftmax_test/qsoftmax_test+0x41bcb7f)
#1 0x405b6a8 in pytorch_qnnp_create_softargmax_nc_q8 xplat/caffe2/aten/src/ATen/native/quantized/cpu/qnnpack/src/softargmax.c:85
SUMMARY- AddressSanitizer: 1632 byte(s) leaked in 2 allocation(s).
```
After this diff:
- No errors
___
# Testing op correctness
```
cd ~/fbsource/fbcode
buck test caffe2/test/quantization:quantization -- test_qsoftmax
```
Passes
- https://www.internalfb.com/intern/testinfra/testconsole/testrun/2814749908834332/
Differential Revision: D41487341
Pull Request resolved: https://github.com/pytorch/pytorch/pull/89544
Approved by: https://github.com/mcr229