We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 2313

Summary: File pointer fp getting leak in timidity.c, read_config_file(const char *name) Function
Product: SDL_mixer Reporter: Nitz <nitin.j4>
Component: miscAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: critical    
Priority: P2 CC: sezeroz
Version: 1.2.12   
Hardware: x86   
OS: Linux   

Description Nitz 2013-12-18 05:30:52 UTC
In static int read_config_file(const char *name) function file pointer *fp getting leaks at:
1) if (words < 2)
       {
        ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
          "%s: line %d: No directory given\n", name, line);
        return -2;
       }
2) if (words < 2)
      {
        ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
          "%s: line %d: No file name given\n", name, line);
        return -2;
     }
3) if (words != 2)
      {
        ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
        "%s: line %d: Must specify exactly one patch name\n",
          name, line);
        return -2;
      }
4) if (words < 2)
      {
        ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
          "%s: line %d: No drum set number given\n",
          name, line);
      return -2;
      }
5) if (i<0 || i>127)
     {
        ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
          "%s: line %d: Drum set must be between 0 and 127\n",
        name, line);
        return -2;
     }
6) if (words < 2)
     {
        ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
          "%s: line %d: No bank number given\n",
        name, line);
        return -2;
     }
7) if (i<0 || i>127)
      {
        ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
          "%s: line %d: Tone bank must be between 0 and 127\n",
        name, line);
        return -2;
      }
8) if ((words < 2) || (*w[0] < '0' || *w[0] > '9'))
    {
     ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
        "%s: line %d: syntax error\n", name, line);
     return -2;
    }
9)  if (i<0 || i>127)
    {
      ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
        "%s: line %d: Program must be between 0 and 127\n",
        name, line);
      return -2;
    }
10)  if (!bank)
    {
      ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
       "%s: line %d: Must specify tone bank or drum set "
        "before assignment\n",
        name, line);
     return -2;
    }
11) if (!(cp=strchr(w[j], '=')))
        {
    ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "%s: line %d: bad patch option %s\n",
      name, line, w[j]);
    return -2;
        }
12) if ((k<0 || k>MAX_AMPLIFICATION) || (*cp < '0' || *cp > '9'))
      {
       ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
          "%s: line %d: amplification must be between "
         "0 and %d\n", name, line, MAX_AMPLIFICATION);
       return -2;
      }
13) if ((k<0 || k>127) ||
       (k==0 && *cp!='-' && (*cp < '0' || *cp > '9')))
      {
       ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
         "%s: line %d: panning must be left, right, "
         "center, or between -100 and 100\n",
         name, line);
       return -2;
      }
14) else
      {
        ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
          "%s: line %d: keep must be env or loop\n", name, line);
       return -2;
      }
15) else
      {
       ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
         "%s: line %d: strip must be env, loop, or tail\n",
         name, line);
       return -2;
      }
16) else
      {
    ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "%s: line %d: bad patch option %s\n",
      name, line, w[j]);
    return -2;
      }

free the fp pointer by calling close_file(fp); before return -2;

Thanks...
Comment 1 Ozkan Sezer 2020-10-26 16:53:21 UTC
This has been fixed for quite some.