double free or corruption error c++
<p>i have a code for a graphic engine, it need to draw wire frames and line drawings, i made some adjustments to te original code of mine and now i get the error double free or corruption, but before the code worked just fine, does annybody know what i'm doing wrong?</p>

<pre><code>void Wireframe::Generate(list&lt;eye_point&gt; &amp;points, list&lt;line&gt; &amp;lines, const ini::Configuration &amp;configuration)
{
    string buffer;
    stringstream out;
    for(int i = 0; i &lt; nrFigures; i++)
    {
        figure = "Figure";
        out&lt;&lt;i;
        buffer = out.str();
        figure.append(buffer);
        out.str(string());
        cout&lt;&lt;"de figure heeft de naam "&lt;&lt;figure&lt;&lt;endl;
        Read_info(configuration);
        Generate_points(points, configuration);
        Generate_lines(lines, configuration);
    }
}
</code></pre>

<p>in read info he reads the info from the ini file </p>

<pre><code>void Wireframe::Generate_points(list&lt;eye_point&gt; &amp;points, const ini::Configuration &amp;configuration){
    Matrix schaal = Scale(scale);
    Matrix translate = Translatie(center);
    Matrix xrotate = Rotate_x_as(rotatex);
    Matrix yrotate = Rotate_y_as(rotatey);
    Matrix zrotate = Rotate_z_as(rotatez);
    Matrix eyematrix = Eye_transformatie(eye);
    Matrix matrix;
    matrix = schaal * translate * xrotate  * yrotate * zrotate * eyematrix;
    if(type.compare("LineDrawing") == 0)
    {
        linedrawing_point(points, configuration, matrix);
    }
    else if(type.compare("Cube") == 0)
    {
        cube_point(points,matrix);
    }
}

void Wireframe::Generate_lines(list&lt;line&gt; &amp;lines, const ini::Configuration &amp;configuration){
    if(type.compare("LineDrawing") == 0)
    {
        linedrawing_lines(lines, configuration);
    }
    else if (type.compare("Cube") == 0)
    {
        cube_lines(lines);
    }
}
</code></pre>

<p>here he sees wha for line drawing he needs to do, were by line drawing works just fine, the error is in cube.</p>

<pre><code>void Wireframe::cube_lines(list&lt;line&gt; &amp;lines){
    getline(lines, 1, 5);
    getline(lines, 5, 3);
    getline(lines, 3, 7);
    getline(lines, 7, 1);
    getline(lines, 5, 2);
    getline(lines, 2, 8);
    getline(lines, 8, 3);
    getline(lines, 3, 5);
    getline(lines, 2, 6);
    getline(lines, 6, 4);
    getline(lines, 4, 8);
    getline(lines, 8, 2);
    getline(lines, 6, 1);
    getline(lines, 1, 7);
    getline(lines, 7, 4);
    getline(lines, 4, 6);
    getline(lines, 7, 3);
    getline(lines, 3, 8);
    getline(lines, 8, 4);
    getline(lines, 4, 7);
    getline(lines, 1, 6);
    getline(lines, 6, 2);
    getline(lines, 2, 5);
    getline(lines, 5, 1);
}



void Wireframe::cube_point(list&lt;eye_point&gt; &amp;points, Matrix &amp;matrix){
    getpoint(1, -1, -1, points, 1, matrix );
    getpoint(-1, 1, -1, points, 2, matrix );
    getpoint(1, 1, 1, points, 3, matrix );
    getpoint(-1, -1, 1, points, 4, matrix );
    getpoint(1, 1, -1, points, 5, matrix );
    getpoint(-1, -1, -1, points, 6, matrix );
    getpoint(1, -1, 1, points, 7, matrix );
    getpoint(-1, 1, 1, points, 1, matrix );
}

void Wireframe::projectie(Vector3D &amp;vector_points, eye_point &amp;point_element){
    point_element.z = vector_points.z;
    if(vector_points.z != 0)
    {
        point_element.x = vector_points.x / -vector_points.z;
        point_element.y = vector_points.y / -vector_points.z;
    }
    else
    {
        point_element.x = vector_points.x;
        point_element.y = vector_points.y;
    }

}

void Wireframe::getpoint(double x, double y, double z, list&lt;eye_point&gt; &amp;points, int nummer, Matrix &amp;matrix ){
    eye_point point_element;
    Vector3D vector_points = Vector3D::point(x, y, z);
    vector_points *=  matrix;
    point_element.figure = figure;
    point_element.punt = nummer;
    projectie(vector_points, point_element);
    points.push_back(point_element);
}

void Wireframe::getline(list&lt;line&gt; &amp;lines, int lijn0, int lijn1){
    line line_element;
    line_element.lijn0 = lijn0;
    line_element.lijn1 = lijn1;
    line_element.figure = figure;
    line_element.linecolor = linecolor;
    lines.push_back(line_element);
}
</code></pre>
