excluir heap após retornar o ponteiro

Eu tenho uma função como abaixo

int* readFile(string InputPath)
{
    int *myvar = new int[10]; //The file has 10 lines (Using heap)

    ifstream inFile;

    inFile.open(InputPath.c_str(), ios::in);

    if (inFile.fail())
    {
        cout << "Error reading the input file ";
        cout << InputPath << ".";
        exit(0);
    }
    string fileLine;

    while (getline(inFile, fileLine))
    {
       myvar[i]=toint(fileLine); //will be converted to int!
    }
    ;
    inFile.close();



    return myvar;
}:

Como posso liberar o heap (myvar)? Em geral, qual é o melhor método para retornar tal matriz?

questionAnswers(5)

yourAnswerToTheQuestion