title: malloc causing a SIGSEGV:Segmentation fault
body: <pre><code>typedef struct Matrix
  {
      double * matrix;
      int sizex;
      int sizey;
  }Matrix;
  
  int nn = 257;
  Matrix * g = (Matrix *)malloc(sizeof(Matrix *));
  g-&gt;matrix = malloc(sizeof(double) * nn * nn);
  g-&gt;sizex = nn;
  g-&gt;sizey = nn;
  </code></pre>
  
  <p>This code give an error when it gets to <code>g-&gt;matrix = malloc(sizeof(double) * nn * nn);</code>
  anyone see a problem with it ?</p>
  
  <p>edit: found problem to be accessing unallocated memory in a place before the allocation shown, it was causing a SIGSEGV:Segmentation fault.</p>