A bug of memory leak

harre
2011-04-01
2013-05-14
  • harre
    harre
    2011-04-01

    Hello,
    Please, someone correct me if I'm wrong.

    I found a bug of memory leak.
    static structure "*cd" of "cue_parser.y" was memory leak, when "cue_parser_string()" was parse error and return NULL.

    I think solution code.

    /- cue_parser.y -
    Cd *cue_parse_file(FILE *fp)
    {
      …

      if (0 == yyparse())
      {
        yy_delete_buffer(buffer);
        return cd;
      }
      yy_delete_buffer(buffer);
      cd_delete(cd); <- added this code

      return NULL;
    }
    -/

    also cue_parse_string()

    P.S. Please excuse my English, it isn't good.