title: Writing struct + write(buf) points to uninitialised byte(s)
body: <p>I am allocating space for the struct node in the variable n0. I save this struct to file using fwrite, but when I run valgrind I get this error. My code is below, could you help me please?</p>
  
  <pre><code>==1412== Syscall param write(buf) points to uninitialised byte(s)
  ==1412==    at 0x4F22870: __write_nocancel (syscall-template.S:81)
  ==1412==    by 0x4EB0002: _IO_file_write@@GLIBC_2.2.5 (fileops.c:1261)
  ==1412==    by 0x4EB14DB: _IO_do_write@@GLIBC_2.2.5 (fileops.c:538)
  ==1412==    by 0x4EB0D5F: _IO_file_close_it@@GLIBC_2.2.5 (fileops.c:165)
  ==1412==    by 0x4EA4B0F: fclose@@GLIBC_2.2.5 (iofclose.c:59)
  ==1412==    by 0x400793: main (in /home/grados-sanchez/git/merkle-codigos-C/test_file)
  ==1412==  Address 0x402500c is not stack'd, malloc'd or (recently) free'd
  ==1412==  Uninitialised value was created by a stack allocation
  ==1412==    at 0x40073F: main (in /home/grados-sanchez/git/merkle-codigos-C/test_file)
  
  typedef struct {
      unsigned char * ustr;
      int height;
  }node;
  
  void node_init(node * n, int r) {
  
      int i;
      n-&gt;ustr = malloc((r + 1) * sizeof(unsigned char));
      for (i = 0; i &lt; r; i++) {
          (n-&gt;ustr)[i] = random() &amp; 0xff;
      }
      (n-&gt;ustr)[r] = 0;
      n-&gt;height = -1;
  }
  void node_destroy(node * n) {
      free(n-&gt;ustr);
      n-&gt;height = -1;
  }
  
  int main() {
      FILE* file_ptr = fopen("file1", "w+");
      node n0;
      node_init(&amp;n0,2);
      fwrite(&amp;n0, sizeof(node), 1, file_ptr);
      fclose(file_ptr);
      node_destroy(&amp;n0);
      return 0;
  }
  </code></pre>