How to remove sigabrt runtime error?

For the practice(easy) question Sums in a Triangle - http://www.codechef.com/problems/SUMTRIAN

why is my code giving sigabrt error? I’ve googled it and I am a bit confused. At some places it was given the error is raised on not deleting allocated pointer memory and at some other places it was written that deleting already deleted memory gives the error. Please tell me what exactly this error is and how should I remove it.

I’ve tried to solve the question using recursion. I believe that the code will give the correct answer as it is giving for the given test case and some of my own. I want to know about the sigabrt error and how should i remove it.

Here is my code. -

#include<iostream>
using namespace std;

int sum(int **matrix,int n,int i,int j)
{
    if(i==(n-1))
        return matrix[i][j];
    else
    {
        int total=matrix[i][j];
        total+=max(sum(matrix,n,i+1,j),sum(matrix,n,i+1,j+1));
        return total;
    }
}

int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int n;
        cin>>n;
        int **matrix=new int*[n];
        for(int i=0;i<n;i++)
        {
            matrix[i]=new int[i];
            for(int j=0;j<=i;j++)
                cin>>matrix[i][j];
        }
        cout<<sum(matrix,n,0,0)<<endl;
    }
}

@admin Please tell me the answer.!

@admin??? answer please…

//