Skip to content

Commit d8a422e

Browse files
committed
Infer fixes for WolfSSLCertificate
1 parent 5d5733f commit d8a422e

1 file changed

Lines changed: 13 additions & 11 deletions

File tree

src/java/com/wolfssl/WolfSSLCertificate.java

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,9 @@ protected long getX509Ptr() throws IllegalStateException {
323323

324324
confirmObjectIsActive();
325325

326-
return this.x509Ptr;
326+
synchronized (x509Lock) {
327+
return this.x509Ptr;
328+
}
327329
}
328330

329331
/**
@@ -1435,14 +1437,14 @@ public Collection<List<?>> getSubjectAltNames()
14351437

14361438
confirmObjectIsActive();
14371439

1438-
if (this.altNames != null) {
1439-
/* already gathered, return cached version */
1440-
return this.altNames;
1441-
}
1440+
synchronized (x509Lock) {
1441+
if (this.altNames != null) {
1442+
/* already gathered, return cached version */
1443+
return this.altNames;
1444+
}
14421445

1443-
Collection<List<?>> names = new ArrayList<List<?>>();
1446+
Collection<List<?>> names = new ArrayList<List<?>>();
14441447

1445-
synchronized (x509Lock) {
14461448
String nextAltName = X509_get_next_altname(this.x509Ptr);
14471449
while (nextAltName != null) {
14481450
Object[] entry = new Object[2];
@@ -1453,12 +1455,12 @@ public Collection<List<?>> getSubjectAltNames()
14531455
names.add(Collections.unmodifiableList(entryList));
14541456
nextAltName = X509_get_next_altname(this.x509Ptr);
14551457
}
1456-
}
14571458

1458-
/* cache altNames collection for later use */
1459-
this.altNames = Collections.unmodifiableCollection(names);
1459+
/* cache altNames collection for later use */
1460+
this.altNames = Collections.unmodifiableCollection(names);
14601461

1461-
return this.altNames;
1462+
return this.altNames;
1463+
}
14621464
}
14631465

14641466
/**

0 commit comments

Comments
 (0)