Commit d1b43a3
[Android] Fix X509Store cleanup (#128629)
Fixes Android X509Store PAL cleanup paths for certificate/private-key
entries and JNI local references to avoid memory leaks.
Follow-up to #128284
## Changes
- Dispose the Android `KeyStore.PrivateKeyEntry` wrapper held by
`AndroidCertificatePal`.
- Release JNI local references on Android X509Store cleanup paths:
- trusted certificate enumeration
- default store open failure/success cleanup
- remove-certificate early success path
- Add JNI exception checks when advancing Android KeyStore alias
enumerations.
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent b7575a1 commit d1b43a3
2 files changed
Lines changed: 30 additions & 22 deletions
File tree
- src
- libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates
- native/libs/System.Security.Cryptography.Native.Android
Lines changed: 7 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
575 | 575 | | |
576 | 576 | | |
577 | 577 | | |
578 | | - | |
579 | | - | |
580 | | - | |
581 | | - | |
582 | | - | |
| 578 | + | |
| 579 | + | |
583 | 580 | | |
584 | | - | |
585 | | - | |
586 | | - | |
587 | | - | |
588 | | - | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
589 | 586 | | |
590 | 587 | | |
591 | 588 | | |
| |||
Lines changed: 23 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
273 | 273 | | |
274 | 274 | | |
275 | 275 | | |
| 276 | + | |
276 | 277 | | |
277 | 278 | | |
278 | 279 | | |
| |||
311 | 312 | | |
312 | 313 | | |
313 | 314 | | |
| 315 | + | |
314 | 316 | | |
315 | 317 | | |
316 | 318 | | |
| |||
365 | 367 | | |
366 | 368 | | |
367 | 369 | | |
| 370 | + | |
368 | 371 | | |
369 | 372 | | |
| 373 | + | |
370 | 374 | | |
371 | 375 | | |
372 | 376 | | |
373 | 377 | | |
374 | 378 | | |
375 | | - | |
376 | | - | |
| 379 | + | |
| 380 | + | |
377 | 381 | | |
378 | | - | |
379 | | - | |
| 382 | + | |
380 | 383 | | |
381 | 384 | | |
382 | 385 | | |
383 | | - | |
384 | | - | |
385 | 386 | | |
386 | | - | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
387 | 392 | | |
388 | 393 | | |
389 | 394 | | |
390 | 395 | | |
391 | 396 | | |
392 | | - | |
| 397 | + | |
393 | 398 | | |
394 | 399 | | |
395 | 400 | | |
| |||
431 | 436 | | |
432 | 437 | | |
433 | 438 | | |
| 439 | + | |
434 | 440 | | |
435 | 441 | | |
436 | | - | |
| 442 | + | |
| 443 | + | |
437 | 444 | | |
438 | 445 | | |
439 | 446 | | |
| |||
444 | 451 | | |
445 | 452 | | |
446 | 453 | | |
| 454 | + | |
447 | 455 | | |
448 | 456 | | |
449 | 457 | | |
450 | 458 | | |
451 | 459 | | |
452 | | - | |
| 460 | + | |
| 461 | + | |
453 | 462 | | |
454 | 463 | | |
455 | 464 | | |
456 | 465 | | |
| 466 | + | |
457 | 467 | | |
458 | | - | |
459 | | - | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
460 | 471 | | |
461 | 472 | | |
462 | 473 | | |
| |||
0 commit comments