Skip to content

Commit 48ff226

Browse files
committed
Fix potentially uninitialized use in ldap
If ctrl->ldctl_value.bv_len is zero context is uninitialized. Only free it if the call took place and succeeded.
1 parent 6cc5398 commit 48ff226

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ext/ldap/ldap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,10 +265,10 @@ static void _php_ldap_control_to_array(LDAP *ld, LDAPControl* ctrl, zval* array,
265265
add_assoc_stringl(&value, "context", context->bv_val, context->bv_len);
266266
}
267267
add_assoc_zval(array, "value", &value);
268+
ber_bvfree(context);
268269
} else {
269270
add_assoc_null(array, "value");
270271
}
271-
ber_bvfree(context);
272272
} else {
273273
if (ctrl->ldctl_value.bv_len) {
274274
add_assoc_stringl(array, "value", ctrl->ldctl_value.bv_val, ctrl->ldctl_value.bv_len);

0 commit comments

Comments
 (0)