[Bug 1123588] Re: wrong usage of the `malloc' function attribute

James Hunt 1123588 at bugs.launchpad.net
Mon Feb 25 11:56:11 UTC 2013


A common convention in Upstart+NIH is for functions to accept a parent
pointer as in the following example:

Foo *make_foo (const void *parent) __attribute__ ((malloc));

Foo *
make_foo (const void *parent)
{
	Foo *foo = nih_new (parent, Foo);

        /* ... */

	return foo;
}

But, if I'm understanding this correctly (?), using the malloc attribute
here is also invalid iff parent != NULL since nih_new() ultimately saves
the value of foo to the parents context before returning the address of
foo.

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to upstart in Ubuntu.
https://bugs.launchpad.net/bugs/1123588

Title:
  wrong usage of the `malloc' function attribute

Status in The GNU Compiler Collection:
  Invalid
Status in Upstart:
  Triaged
Status in “gcc-4.7” package in Ubuntu:
  Fix Released
Status in “upstart” package in Ubuntu:
  Triaged
Status in “gcc-4.7” source package in Raring:
  Fix Released
Status in “upstart” source package in Raring:
  Triaged

Bug description:
  seen with -21ubuntu1, not with -20ubuntu1, reverting the fix for
  PR53844 avoids the issue.

  I think we need a reproducer in upstart, which doesn't just hang.

To manage notifications about this bug go to:
https://bugs.launchpad.net/gcc/+bug/1123588/+subscriptions




More information about the foundations-bugs mailing list