]> git.ipfire.org Git - thirdparty/FORT-validator.git/commitdiff
Fix random errors
authorAlberto Leiva Popper <ydahhrk@gmail.com>
Thu, 5 Dec 2024 12:44:56 +0000 (09:44 -0300)
committerAlberto Leiva Popper <ydahhrk@gmail.com>
Thu, 5 Dec 2024 12:44:56 +0000 (09:44 -0300)
Not much to say. Testing some slightly dirtier inputs; these pipelines
were crashing or returning incorrectly.

src/cache.c
src/object/certificate.c
src/resource.c

index 6cf6f9bac44716e7d1f95a8146cb44ce64d6200a..07dab4c90d11a828934a0f63b091126a585faa6d 100644 (file)
@@ -910,13 +910,12 @@ cache_refresh_by_sias(struct sia_uris *sias, struct cache_cage **result)
        if (!node)
                return EINVAL; /* Nothing to work with */
 
-       *result = cage = pmalloc(sizeof(struct cache_cage));
-       cage->refresh = NULL;
+       *result = cage = pzalloc(sizeof(struct cache_cage));
        cage->fallback = node;
        return 0;
 
 refresh_success:
-       *result = cage = pmalloc(sizeof(struct cache_cage));
+       *result = cage = pzalloc(sizeof(struct cache_cage));
        cage->rpkiNotify = rpkiNotify;
        cage->refresh = node;
        cage->fallback = get_fallback(sias);
index 3f59f5ac8a18a0be7c07d74981a3dcf1cff012f6..2a1b810b7b9a256fd09572f651a4fdc8b05a7076 100644 (file)
@@ -1848,8 +1848,10 @@ certificate_validate(struct rpki_certificate *cert)
        fnstack_push_map(&cert->map);
 
        cert->x509 = certificate_load(cert->map.path);
-       if (!cert->x509)
-               return -EINVAL;
+       if (!cert->x509) {
+               error = -EINVAL;
+               goto end;
+       }
        cert->type = get_certificate_type(cert);
 
        error = certificate_validate_chain(cert);
index 4468bccec6a507d4c0b48b5866d88e214394f2d3..980ae8fc38504fdc84de9e20490f1e8ea7605822 100644 (file)
@@ -45,6 +45,9 @@ resources_create(enum rpki_policy policy, bool force_inherit)
 void
 resources_destroy(struct resources *resources)
 {
+       if (resources == NULL)
+               return;
+
        if (resources->ip4s != NULL)
                res4_put(resources->ip4s);
        if (resources->ip6s != NULL)