eliminar montón después de devolver puntero

Tengo una función como la de abajo

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;
}:

¿Cómo puedo liberar el montón (myvar)? En general, ¿cuál es el mejor método para devolver dicha matriz?

Respuestas a la pregunta(5)

Su respuesta a la pregunta