Git Product home page Git Product logo

Comments (5)

bailey27 avatar bailey27 commented on September 25, 2024

@mhogomchungu ,

Thank you for pointing out the potential memory leak.

In write_volume_name(), I should not be returning from inside the try. I normally don't do that, because I normally want to use the catch to set an error return value and free resources after the catch block.

In this particular case, the error condition on line 426 is extremely unlikely to happen, and the code is called only when the fs is unmounted and only if the user has changed the volume name.

It will be fixed in the next release.

I started coding cppcryptfs after a long hiatus from C++ programming. I wrote most of the code before I started learning the new features from c++11. That is why you see c++11 features used in some places but not in other places where it would be desirable to use them.

I agree that I should have used the RAII pattern more and there are many places where std::vector should have been used instead of a raw buffer and also many places where std::unique_ptr would have been useful.

from cppcryptfs.

mhogomchungu avatar mhogomchungu commented on September 25, 2024

I suspected that returning early with return statement was probably a lapse of some sort since your code pattern seems to be returning early by throwing.

If you are using C++14, a function that i use to manage pointer based resource with std::unique_ptr is here[1]. It should be easy to write a custom function that returns a FILE handle for the function to manage. It should be easy to modify the function to be C++11. Let me know if you want to use it and want it to be customized for your particular case and i will make a pull request with the necessary changes.

[1] https://github.com/mhogomchungu/sirikali/blob/8ffae0f32e69657987c484683ce1b3b62e160e21/src/utility2.h#L53-L70

from cppcryptfs.

bailey27 avatar bailey27 commented on September 25, 2024

Yes, I can use C++14. I would like for you to make a pull request with your changes please.

from cppcryptfs.

mhogomchungu avatar mhogomchungu commented on September 25, 2024

My fork of your repository is here[1] and i have made these[2] changes so far.

[1] https://github.com/mhogomchungu/cppcryptfs

[2] https://github.com/mhogomchungu/cppcryptfs/commits/master

any comments?

from cppcryptfs.

bailey27 avatar bailey27 commented on September 25, 2024

Pull request merged. Thank you!

from cppcryptfs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.