]> git.ipfire.org Git - thirdparty/FORT-validator.git/commitdiff
Release CRL on error branch
authorAlberto Leiva Popper <ydahhrk@gmail.com>
Tue, 3 Oct 2023 15:37:57 +0000 (09:37 -0600)
committerAlberto Leiva Popper <ydahhrk@gmail.com>
Tue, 3 Oct 2023 15:40:38 +0000 (09:40 -0600)
Fixes memory leak.

src/object/crl.c

index 407d8d5983626d33fc0e9dba569b12e4964d4a0b..2cd0de3ba4000d946c1c910b992efb36852b4d68 100644 (file)
@@ -154,12 +154,18 @@ int
 crl_load(struct rpki_uri *uri, X509_CRL **result)
 {
        int error;
+
        pr_val_debug("CRL '%s' {", uri_val_get_printable(uri));
 
        error = __crl_load(uri, result);
-       if (!error)
-               error = crl_validate(*result);
+       if (error)
+               goto end;
 
+       error = crl_validate(*result);
+       if (error)
+               X509_CRL_free(*result);
+
+end:
        pr_val_debug("}");
        return error;
 }