krb5 commit: Fix prepend_err_str in LDAP KDB module

Greg Hudson ghudson at MIT.EDU
Tue Jan 29 13:46:11 EST 2013


https://github.com/krb5/krb5/commit/e4e222a2471119733ddc1a8cfc648cc2be763974
commit e4e222a2471119733ddc1a8cfc648cc2be763974
Author: Greg Hudson <ghudson at mit.edu>
Date:   Tue Jan 29 13:13:04 2013 -0500

    Fix prepend_err_str in LDAP KDB module
    
    Use the oerr parameter to fetch the existing message.  Stop handling
    oerr == 0, since no call sites were using it.  Free the old error
    message before returning.

 src/plugins/kdb/ldap/libkdb_ldap/kdb_ldap.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/plugins/kdb/ldap/libkdb_ldap/kdb_ldap.c b/src/plugins/kdb/ldap/libkdb_ldap/kdb_ldap.c
index e64d22d..4e0a9e8 100644
--- a/src/plugins/kdb/ldap/libkdb_ldap/kdb_ldap.c
+++ b/src/plugins/kdb/ldap/libkdb_ldap/kdb_ldap.c
@@ -307,9 +307,10 @@ prepend_err_str(krb5_context ctx, const char *str, krb5_error_code err,
                 krb5_error_code oerr)
 {
     const char *omsg;
-    if (oerr == 0) oerr = err;
-    omsg = krb5_get_error_message (ctx, err);
-    krb5_set_error_message (ctx, err, "%s %s", str, omsg);
+
+    omsg = krb5_get_error_message(ctx, oerr);
+    krb5_set_error_message(ctx, err, "%s %s", str, omsg);
+    krb5_free_error_message(ctx, omsg);
 }
 
 extern krb5int_access accessor;


More information about the cvs-krb5 mailing list