Git Product home page Git Product logo

Comments (7)

edmooring avatar edmooring commented on June 2, 2024

This seems to be a bug in the Linux libmetal implementation. The function returns void, so it can't return an error on multiple invocations, but it should not create a segfault.

from libmetal.

edmooring avatar edmooring commented on June 2, 2024

@sjd-xlnx Can you try #185 to see if this fixes your issue? It works in my limited testing.

from libmetal.

edmooring avatar edmooring commented on June 2, 2024

This entire problem could be avoided if libmetal took advantage of the ELF initialization and finalizations sections like most Linux (and other?) libraries. We could avoid the need for explicit initialization and finalization functions entirely.

from libmetal.

sjd-xlnx avatar sjd-xlnx commented on June 2, 2024

Hi, I looked at the proposed change, and it doesn't look right to me.

void metal_finish(void)
{
	/* if metal_init() failed, or metal_finish() is called twice, just return */
	if (_metal.common.initialized)
		return;
	metal_sys_finish();
	memset(&_metal, 0, sizeof(_metal));
}

Shouldn't it be something like this...

void metal_finish(void)
{
	/* if metal_init() failed, or metal_finish() is called twice, just return */
	if (!_metal.common.initialized)
		return;
	metal_sys_finish();
	memset(&_metal, 0, sizeof(_metal));
}

or ...

void metal_finish(void)
{
	/* if metal_init() failed, or metal_finish() is called twice, just return */
	if (_metal.common.initialized) {
		metal_sys_finish();
		memset(&_metal, 0, sizeof(_metal));
	}
	return;
}

from libmetal.

edmooring avatar edmooring commented on June 2, 2024

You're absolutely correct. The '!' is in my source tree but not in git. I must have messed something up in my edit.

from libmetal.

github-actions avatar github-actions commented on June 2, 2024

This issue has been marked as a stale issue because it has been open (more than) 45 days with no activity.

from libmetal.

arnopo avatar arnopo commented on June 2, 2024

Should be Fixed by #239, please reopen the issue if not the case.

from libmetal.

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.