commit f27c43b929d4140964704367d0bc77c8b42e6f15
parent d99686bea445a19ac1048b17d93e4314fa3e167d
Author: wwp <subscript@free.fr>
Date: Tue, 5 Oct 2021 12:27:52 +0200
Fix CID 1491230: resource leak.
Diffstat:
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/ldapctrl.c b/src/ldapctrl.c
@@ -575,14 +575,16 @@ 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 );
}
else {
/* We have something - free up previous result */
retVal = p2;
- g_free( p1 );
}
+ if (p1)
+ g_free( p1 );
debug_print("current search string: %s\n", retVal);
return retVal;
}