[Freeipa-devel] many unchecked strdup calls

Jim Meyering jim at meyering.net
Wed May 14 19:54:51 UTC 2008


I noticed that there are many unchecked strdup calls.
Most look like this:

    result_string = strdup("Failed to init kerberos context");
    result_err = KRB5_KPASSWD_HARDERROR;
    syslog(LOG_ERR, "%s", result_string);

    result_string = strdup("Failed to get default realm name");
    result_err = KRB5_KPASSWD_HARDERROR;
    syslog(LOG_ERR, "%s", result_string);

Since some uses of strdup are checked, I suppose that those aren't
is an oversight.

If it's ok to exit from that context, the fix may be as simple
as s/strdup/xstrdup/.




More information about the Freeipa-devel mailing list