You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by arpadboda <gi...@git.apache.org> on 2018/11/16 11:22:01 UTC

[GitHub] nifi-minifi-cpp issue #439: MINIFICPP-645 - Move from new to malloc in CAPI ...

Github user arpadboda commented on the issue:

    https://github.com/apache/nifi-minifi-cpp/pull/439
  
    There is no delete, it was wrong before:
    ```
    void free_flowfile(flow_file_record *ff) {
      if (ff == nullptr) {
        return;
      }
      auto content_repo_ptr = static_cast<std::shared_ptr<minifi::core::ContentRepository>*>(ff->crp);
      if (content_repo_ptr->get()) {
        std::shared_ptr<minifi::ResourceClaim> claim = std::make_shared<minifi::ResourceClaim>(ff->contentLocation, *content_repo_ptr);
        (*content_repo_ptr)->remove(claim);
      }
      if (ff->ffp == nullptr) {
        auto map = static_cast<string_map*>(ff->attributes);
        delete map;
      }
      free(ff->contentLocation);
      free(ff);
    ```
    
    The last line is the one that frees. 


---