commit b3e01e3b340b1a2ced8bd50e1b8eaea9eb5dabdf
parent ac14ec50d655c16fd6813526fd18d57d0f0e18ef
Author: wwp <subscript@free.fr>
Date: Wed, 6 Oct 2021 09:39:11 +0200
Fix CID 1492329: use after free (proper fix for CID 1491230).
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/ldapctrl.c b/src/ldapctrl.c
@@ -575,7 +575,6 @@ gchar *ldapctl_format_criteria( LdapControl *ctl, const gchar *searchVal ) {
}
if( p2 == NULL ) {
- g_free( p1 );
/* Nothing processed - format a default attribute */
retVal = g_strdup_printf( "(%s=*)", LDAPCTL_ATTR_EMAIL );
}
@@ -583,6 +582,8 @@ gchar *ldapctl_format_criteria( LdapControl *ctl, const gchar *searchVal ) {
/* We have something - free up previous result */
retVal = p2;
}
+ if (p1)
+ g_free( p1 );
debug_print("current search string: %s\n", retVal);
return retVal;
}