title: glibc detected error - id3Tag
body: <p>So, I'm new to C and i've been trying to write this tool to edit the id3 tags on music files from the command line. I've been getting this error: </p>
  
  <blockquote>
    <p><strong>* glibc detected <em></strong> double free or corruption (top): 0x0000000000502010 *</em>*</p>
  </blockquote>
  
  <p>From what I've read, I know it has something to do with freeing up memory. I'm just not really sure where to go from here, though. Anyway, my logic was that if a tag existed I'd read that tag in, then make whatever changes needed to be made from the fields specified in the command line. Here's the block that's been giving me trouble. Thanks for any insight in advance!</p>
  
  <pre><code>    fopen(argv[1], "rb");
      fseek(in_file, -128, SEEK_END);
      fread(&amp;tagTest, sizeof(struct iD3Tag), 1, in_file);
      fclose(in_file);
  
      for (x = 2; x &lt; argc-1; x++)
      {            
          if (strcmp(argv[x], "-title"))
              strncpy(tagTest.title, argv[x+1], 30);
          if (strcmp(argv[x], "-artist"))
              strncpy(tagTest.artist, argv[x+1], 30);
          if (strcmp(argv[x], "-album"))
              strncpy(tagTest.album, argv[x+1], 30);
          if (strcmp(argv[x], "-year"))
              strncpy(tagTest.year, argv[x+1], 4);
          if (strcmp(argv[x], "-comment"))
              strncpy(tagTest.comment, argv[x+1], 28);
          if (strcmp(argv[x], "-track"))
              tagTest.track = atoi(argv[x+1]);
      }
  
      tagTest.seperator = 0;
  
      fopen(argv[1], "r+b");
      fseek(in_file, -128, SEEK_END);
      fwrite(&amp;tagTest, sizeof(struct iD3Tag), 1, in_file);
      fclose(in_file);
  </code></pre>