]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Fix request leak in unit_test_module on error, by smashing it with a big hammer...
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 7 Mar 2019 05:24:38 +0000 (13:24 +0800)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 7 Mar 2019 07:37:49 +0000 (15:37 +0800)
src/bin/unit_test_module.c

index 02de4fbe0101bea1e02b82ae69d7456f74b5b408..a234f2e337647060ebeb723252d499c753ad86f1 100644 (file)
@@ -171,7 +171,7 @@ static RADCLIENT *client_alloc(TALLOC_CTX *ctx, char const *ip, char const *name
        return client;
 }
 
-static REQUEST *request_from_file(FILE *fp, fr_event_list_t *el, RADCLIENT *client)
+static REQUEST *request_from_file(TALLOC_CTX *ctx, FILE *fp, fr_event_list_t *el, RADCLIENT *client)
 {
        VALUE_PAIR      *vp;
        REQUEST         *request;
@@ -183,7 +183,7 @@ static REQUEST *request_from_file(FILE *fp, fr_event_list_t *el, RADCLIENT *clie
        /*
         *      Create and initialize the new request.
         */
-       request = request_alloc(NULL);
+       request = request_alloc(ctx);
        gettimeofday(&now, NULL);
 
        /*
@@ -929,7 +929,7 @@ int main(int argc, char *argv[])
        /*
         *      Grab the VPs from stdin, or from the file.
         */
-       request = request_from_file(fp, el, client);
+       request = request_from_file(autofree, fp, el, client);
        if (!request) {
                fprintf(stderr, "Failed reading input: %s\n", fr_strerror());
                EXIT_WITH_FAILURE;