blueloveTH 2 years ago
parent
commit
b8b42a8414
1 changed files with 1 additions and 6 deletions
  1. 1 6
      include/pocketpy/obj.h

+ 1 - 6
include/pocketpy/obj.h

@@ -74,12 +74,7 @@ struct Bytes{
     Bytes& operator=(const Bytes& rhs) = delete;
     std::pair<unsigned char*, int> detach() noexcept;
 
-    ~Bytes(){
-        if(_data != nullptr){
-            free(_data);
-            _data = nullptr;
-        }
-    }
+    ~Bytes(){ delete[] _data;}
 };
 
 using Super = std::pair<PyObject*, Type>;