mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-09-27 17:52:58 +02:00
gtlscertificate: Hold a ref on the root certificate when building chains
This is unlikely to be a bug in practice, as the certificate pointed to
by `root` should have a ref held on it as the issuer of another
certificate in the chain.
However, we can’t guarantee that’s how the `GTlsCertificate`
implementation behaves, so keep a temporary ref on `root` until it’s no
longer needed.
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
Coverity CID: #1489985
(cherry-picked from commit 2c75c392eb
)
This commit is contained in:
committed by
Marco Trevisan (Treviño)
parent
8434e704f1
commit
e52494c49b
@@ -624,7 +624,7 @@ create_certificate_chain_from_list (GSList *pem_list,
|
||||
|
||||
/* root will point to the last certificate in the file. */
|
||||
if (!root)
|
||||
root = cert;
|
||||
root = g_object_ref (cert);
|
||||
|
||||
pem = g_slist_next (pem);
|
||||
}
|
||||
@@ -639,6 +639,8 @@ create_certificate_chain_from_list (GSList *pem_list,
|
||||
g_clear_object (&cert);
|
||||
}
|
||||
|
||||
g_clear_object (&root);
|
||||
|
||||
return cert;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user