backport fix for bug #2968. (from 2.0 branch commit a9867904addc). SDL-1.2
authorOzkan Sezer <sezeroz@gmail.com>
Sun, 07 Oct 2018 01:39:10 +0300
branchSDL-1.2
changeset 8792af89c5af8b5
parent 878 294db2bca9b0
child 880 281ee0037d92
backport fix for bug #2968. (from 2.0 branch commit a9867904addc).
timidity/timidity.c
     1.1 --- a/timidity/timidity.c	Sun Oct 07 01:37:10 2018 +0300
     1.2 +++ b/timidity/timidity.c	Sun Oct 07 01:39:10 2018 +0300
     1.3 @@ -68,6 +68,7 @@
     1.4         {
     1.5          ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
     1.6            "%s: line %d: No directory given\n", name, line);
     1.7 +        close_file(fp);
     1.8          return -2;
     1.9         }
    1.10        for (i=1; i<words; i++)
    1.11 @@ -79,6 +80,7 @@
    1.12        {
    1.13          ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
    1.14            "%s: line %d: No file name given\n", name, line);
    1.15 +        close_file(fp);
    1.16          return -2;
    1.17       }
    1.18      for (i=1; i<words; i++)
    1.19 @@ -95,6 +97,7 @@
    1.20          ctl->cmsg(CMSG_ERROR, VERB_NORMAL, 
    1.21          "%s: line %d: Must specify exactly one patch name\n",
    1.22            name, line);
    1.23 +        close_file(fp);
    1.24          return -2;
    1.25        }
    1.26      strncpy(def_instr_name, w[1], 255);
    1.27 @@ -107,6 +110,7 @@
    1.28          ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
    1.29            "%s: line %d: No drum set number given\n", 
    1.30            name, line);
    1.31 +      close_file(fp);
    1.32        return -2;
    1.33        }
    1.34      i=atoi(w[1]);
    1.35 @@ -115,6 +119,7 @@
    1.36          ctl->cmsg(CMSG_ERROR, VERB_NORMAL, 
    1.37            "%s: line %d: Drum set must be between 0 and 127\n",
    1.38          name, line);
    1.39 +        close_file(fp);
    1.40          return -2;
    1.41       }
    1.42      if (!drumset[i])
    1.43 @@ -131,6 +136,7 @@
    1.44          ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
    1.45            "%s: line %d: No bank number given\n", 
    1.46          name, line);
    1.47 +        close_file(fp);
    1.48          return -2;
    1.49       }
    1.50      i=atoi(w[1]);
    1.51 @@ -139,6 +145,7 @@
    1.52          ctl->cmsg(CMSG_ERROR, VERB_NORMAL, 
    1.53            "%s: line %d: Tone bank must be between 0 and 127\n",
    1.54          name, line);
    1.55 +        close_file(fp);
    1.56          return -2;
    1.57        }
    1.58      if (!tonebank[i])
    1.59 @@ -161,6 +168,7 @@
    1.60        ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
    1.61          "%s: line %d: Program must be between 0 and 127\n",
    1.62          name, line);
    1.63 +      close_file(fp);
    1.64        return -2;
    1.65      }
    1.66    if (!bank)
    1.67 @@ -169,6 +177,7 @@
    1.68         "%s: line %d: Must specify tone bank or drum set "
    1.69          "before assignment\n",
    1.70          name, line);
    1.71 +     close_file(fp);
    1.72       return -2;
    1.73      }
    1.74    if (bank->tone[i].name)
    1.75 @@ -184,6 +193,7 @@
    1.76          {
    1.77      ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "%s: line %d: bad patch option %s\n",
    1.78        name, line, w[j]);
    1.79 +    close_file(fp);
    1.80      return -2;
    1.81          }
    1.82        *cp++=0;
    1.83 @@ -195,6 +205,7 @@
    1.84         ctl->cmsg(CMSG_ERROR, VERB_NORMAL, 
    1.85            "%s: line %d: amplification must be between "
    1.86           "0 and %d\n", name, line, MAX_AMPLIFICATION);
    1.87 +       close_file(fp);
    1.88         return -2;
    1.89        }
    1.90      bank->tone[i].amp=k;
    1.91 @@ -207,6 +218,7 @@
    1.92         ctl->cmsg(CMSG_ERROR, VERB_NORMAL, 
    1.93           "%s: line %d: note must be between 0 and 127\n",
    1.94            name, line);
    1.95 +        close_file(fp);
    1.96          return -2;
    1.97        }
    1.98      bank->tone[i].note=k;
    1.99 @@ -228,6 +240,7 @@
   1.100           "%s: line %d: panning must be left, right, "
   1.101           "center, or between -100 and 100\n",
   1.102           name, line);
   1.103 +       close_file(fp);
   1.104         return -2;
   1.105        }
   1.106      bank->tone[i].pan=k;
   1.107 @@ -242,6 +255,7 @@
   1.108        {
   1.109          ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
   1.110            "%s: line %d: keep must be env or loop\n", name, line);
   1.111 +       close_file(fp);
   1.112         return -2;
   1.113        }
   1.114        }
   1.115 @@ -258,6 +272,7 @@
   1.116         ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
   1.117           "%s: line %d: strip must be env, loop, or tail\n",
   1.118           name, line);
   1.119 +       close_file(fp);
   1.120         return -2;
   1.121        }
   1.122        }
   1.123 @@ -265,6 +280,7 @@
   1.124        {
   1.125      ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "%s: line %d: bad patch option %s\n",
   1.126        name, line, w[j]);
   1.127 +    close_file(fp);
   1.128      return -2;
   1.129        }
   1.130      }