]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Ensure slab element is released on all failure paths
authorNick Porter <nick@portercomputing.co.uk>
Sat, 18 Feb 2023 19:20:25 +0000 (19:20 +0000)
committerNick Porter <nick@portercomputing.co.uk>
Sat, 18 Feb 2023 19:20:25 +0000 (19:20 +0000)
And move error label to placate Coverity

src/modules/rlm_imap/rlm_imap.c

index f0a9de4dd43c2be240e7411084f4e06de8260503..d032ef61e66e9c67960ec3a3e6182a305dc7c67e 100644 (file)
@@ -179,7 +179,6 @@ static unlang_action_t CC_HINT(nonnull(1,2)) mod_authenticate(rlm_rcode_t *p_res
 
        randle = fr_imap_slab_reserve(t->slab);
        if (!randle){
-       error:
                if (randle) fr_imap_slab_release(randle);
                RETURN_MODULE_FAIL;
        }
@@ -187,7 +186,11 @@ static unlang_action_t CC_HINT(nonnull(1,2)) mod_authenticate(rlm_rcode_t *p_res
        FR_CURL_REQUEST_SET_OPTION(CURLOPT_USERNAME, username->vp_strvalue);
        FR_CURL_REQUEST_SET_OPTION(CURLOPT_PASSWORD, password->vp_strvalue);
 
-       if (fr_curl_io_request_enqueue(t->mhandle, request, randle)) RETURN_MODULE_INVALID;
+       if (fr_curl_io_request_enqueue(t->mhandle, request, randle)) {
+       error:
+               fr_imap_slab_release(randle);
+               RETURN_MODULE_FAIL;
+       }
 
        return unlang_module_yield(request, mod_authenticate_resume, imap_io_module_signal, randle);
 }