Jelajahi Sumber

Bug 690584 - #10643 hash_rootpw - fix coverity resource leak issues

https://bugzilla.redhat.com/show_bug.cgi?id=690584
Resolves: bug 690584
Bug Description: #10643 hash_rootpw - fix coverity resource leak issues
Reviewed by: nhosoi (Thanks!)
Branch: master
Fix Description: store the pointer returned by pw_val2scheme and free it
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: no
Rich Megginson 14 tahun lalu
induk
melakukan
8a88106ba1
1 mengubah file dengan 3 tambahan dan 1 penghapusan
  1. 3 1
      ldap/servers/slapd/modify.c

+ 3 - 1
ldap/servers/slapd/modify.c

@@ -1241,7 +1241,9 @@ hash_rootpw (LDAPMod **mods)
 		for (j = 0; mod->mod_bvalues[j] != NULL; j++) {
 			char *val = mod->mod_bvalues[j]->bv_val;
 			char *hashedval = NULL;
-			if (pw_val2scheme (val, NULL, 0)) {
+			struct pw_scheme *pws = pw_val2scheme (val, NULL, 0);
+			if (pws) {
+				free_pw_scheme(pws);
 				/* Value is pre-hashed, no work to do for this value */
 				continue;
 			} else if (! slapd_nss_is_initialized() ) {