Your free() call is inside your if() statement. Here is a reduced version of your code just showing the memory allocation. Move your free() call to after the if() closes:
void quick_sort(int low,int high)
{
char *tempwordy=malloc(40*(sizeof(char)));
if(low<high)
{
free(tempwordy);
}
}