[Bug 1510] New: Wrong memory allocation check in example

bugzilla-daemon at rtems.org bugzilla-daemon at rtems.org
Wed May 5 15:39:22 CDT 2010


           Summary: Wrong memory allocation check in example
           Product: RTEMS
           Version: unknown
          Platform: All
               URL: http://rtems.com/onlinedocs/doc-current/share/rtems/ht
        OS/Version: RTEMS
            Status: NEW
          Severity: trivial
          Priority: P3
         Component: doc
        AssignedTo: joel.sherrill at oarcorp.com
        ReportedBy: alin.codejunkie at gmail.com
                CC: chrisj at rtems.org

The memory allocation check in this example is incorrect

  foo* bar = malloc (sizeof (foo));
  if (!foo)
     return -1;

You should have:

  foo* bar = malloc (sizeof (foo));
  if (!bar)
     return -1;

Since bar is the pointer to the allocated memory

Configure bugmail: https://www.rtems.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.

More information about the rtems-bugs mailing list