[Freeipa-devel] asprintf usage

Jim Meyering jim at meyering.net
Wed May 14 19:58:16 UTC 2008


I noticed some uses of asprintf like this:

  ...
          asprintf(&exterr2, " (%d seconds left before password expires)", bint);
  } else {
          asprintf(&exterr2, " (%d grace logins remaining)", bint);
  }
  if (!exterr2) {
          syslog(LOG_ERR, "exterr2: OOM?");

Note how it test for failure by examining exterr2.
Unfortunately, when asprintf fails (returns -1),
that pointer is specified to be "undefined".




More information about the Freeipa-devel mailing list