Skip to content

Commit 8c685fa

Browse files
committed
Merge branch 'PHP-8.4'
* PHP-8.4: Fix potential leaks when writing to BIO fails
2 parents 2f6c069 + 8a927c2 commit 8c685fa

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

ext/openssl/openssl.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2752,8 +2752,8 @@ PHP_FUNCTION(openssl_pkcs7_read)
27522752
BIO_get_mem_ptr(bio_out, &bio_buf);
27532753
ZVAL_STRINGL(&zcert, bio_buf->data, bio_buf->length);
27542754
add_index_zval(zout, i, &zcert);
2755-
BIO_free(bio_out);
27562755
}
2756+
BIO_free(bio_out);
27572757
}
27582758
}
27592759

@@ -2767,8 +2767,8 @@ PHP_FUNCTION(openssl_pkcs7_read)
27672767
BIO_get_mem_ptr(bio_out, &bio_buf);
27682768
ZVAL_STRINGL(&zcert, bio_buf->data, bio_buf->length);
27692769
add_index_zval(zout, i, &zcert);
2770-
BIO_free(bio_out);
27712770
}
2771+
BIO_free(bio_out);
27722772
}
27732773
}
27742774

@@ -3393,8 +3393,8 @@ PHP_FUNCTION(openssl_cms_read)
33933393
BIO_get_mem_ptr(bio_out, &bio_buf);
33943394
ZVAL_STRINGL(&zcert, bio_buf->data, bio_buf->length);
33953395
add_index_zval(zout, i, &zcert);
3396-
BIO_free(bio_out);
33973396
}
3397+
BIO_free(bio_out);
33983398
}
33993399
}
34003400

@@ -3408,8 +3408,8 @@ PHP_FUNCTION(openssl_cms_read)
34083408
BIO_get_mem_ptr(bio_out, &bio_buf);
34093409
ZVAL_STRINGL(&zcert, bio_buf->data, bio_buf->length);
34103410
add_index_zval(zout, i, &zcert);
3411-
BIO_free(bio_out);
34123411
}
3412+
BIO_free(bio_out);
34133413
}
34143414
}
34153415

0 commit comments

Comments
 (0)