Error: Called Object is Not a Function or Function Pointer [Need Help]

//File Name: "track_distance.h"


typedef struct Point_struct {
    float x;
    float y;
} Point;
float leg_distance(Point *p1, Point *p2);
//File Name: "distance.c"

#include <math.h>
#include "track_distance.h"

float leg_distance(Point *p1, Point *p2)
    float d;

    d = sqrt(((p1->x - p2->x) * (p1->x - p2->x)) + ((p1->y - p2->y) * (p1->y - p2->y)));

    return d;
// File Name: "main.c"

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "track_distance.h"

int waypoint;
int i, j;
float p1, p2;

float leg_distance(Point *p1, Point *p2);

int main()
    printf("** Track Distance Calculator **\n");

    printf("Enter The Number of Waypoints: ");
    scanf("%d", &waypoint);
    printf("Number of Waypoints: %d\n\n", waypoint);

    float *leg_distance = (float*)malloc(waypoint*sizeof(Point));

    for(i = 1; i <= waypoint; ++i)
        printf("Enter (X, Y) for Waypoint %d: ", i);
        scanf("%f, %f", &p1, &p2);
    for(j = 1; j <= waypoint; j++)
        printf("\nWaypoint %d: (X = %f)\t(Y = %f)", j, p1, p2);

    //  TO-DO:
    //  Calculate the Total Distance (Sum of All Distances Between Waypoints).
    //  To do this, use the 'leg_distance()' Function in the "distance.c" File.
    //  Lastly, Output the Total Distance with a 'printf()'

    leg_distance(p1, p2);

    void free(leg_distance);

    return 0;

If Anyone Can Help Me Out I Would Really Appreciate It! I Cannot Seem to Make The Program Work

Up to The Standards Defined Above, Commented Out in main().

Below is an Image of the Console Output and the Error I Receive Upon Compilation.

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum