title: Bus error. Cannot access memory
body: <p>I'm getting bus error.</p>
  
  <p>While debugging the snippet below  and stepping to the end of writeDmpFile I'm getting:</p>
  
  <pre><code>writeDmpFile (tree=0x56a310, filename=0x7fffffffd450 "20140318.221058") at unzipper_m1.c:146
  146 }
  (gdb) n
  Cannot access memory at address 0x38353031323236
  </code></pre>
  
  <p>The file is written though, but program ends with bus error.
  Here the code:</p>
  
  <pre><code>typedef struct dmpParams_t
  {
    char buff[6000000];
    size_t *size;
  }dmpParams_t;
  
  int writeFile(char *name,  unsigned char *buff, size_t *size,const char *dir )
  {
    FILE * pFile;
    chdir (dir);
    pFile = fopen ( name, "wb");
    fwrite (buff , sizeof(unsigned char), *size, pFile);
    fclose (pFile);
  
    return 1;
  }
  
  int writeDmpFile(GTree *tree, char *filename)
  {
    char dmpfilename[32];
  
    dmpfilename[0] ='\0';
    dmpParams_t params;
    params.buff[0]   ='\0';
    size_t size =0;
    params.size=&amp;size ;
    g_tree_foreach(tree, (GTraverseFunc)writeDmpFileLine, &amp;params);
    sprintf (dmpfilename, "InstrumentList_FULL.csv_%.*s", 15, filename);
    writeFile(dmpfilename,  ( unsigned char *)params.buff,  &amp;size , dmpdir);//(size_t *)params.size, dmpdir);
  }
  </code></pre>