]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Don't leak rest handles on connection errors‽
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Tue, 19 Jul 2016 20:52:28 +0000 (16:52 -0400)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Tue, 19 Jul 2016 20:53:26 +0000 (16:53 -0400)
src/modules/rlm_rest/rlm_rest.c

index cc5bb5cf5951b224a63025b29f7324bccd0656db..1a7803c6b992999c105dae74ef9fb00d6f8965ce 100644 (file)
@@ -279,14 +279,20 @@ static ssize_t rest_xlat(void *instance, REQUEST *request,
        ret = rest_request_config(instance, &section, request, handle, section.method, section.body,
                                  uri, NULL, NULL);
        talloc_free(uri);
-       if (ret < 0) return -1;
+       if (ret < 0) {
+               slen = -1;
+               goto finish;
+       }
 
        /*
         *  Send the CURL request, pre-parse headers, aggregate incoming
         *  HTTP body data into a single contiguous buffer.
         */
        ret = rest_request_perform(instance, &section, request, handle);
-       if (ret < 0) return -1;
+       if (ret < 0) {
+               slen = -1;
+               goto finish;
+       }
 
        hcode = rest_get_handle_code(handle);
        switch (hcode) {