Previous 199869 Revisions Next

r20408 Tuesday 22nd January, 2013 at 22:43:33 UTC by Oliver Stöneberg
fixed memory leak in jedutil (nw)
[src/tools]jedutil.c

trunk/src/tools/jedutil.c
r20407r20408
33383338   /* read the source file */
33393339   err = read_source_file(srcfile);
33403340   if (err != 0)
3341   {
3342      free(srcbuf);
33413343      return 1;
3344   }
33423345
33433346   memset(&jed, 0, sizeof(jed));
33443347
r20407r20408
33743377      if (!dstbuf)
33753378      {
33763379         fprintf(stderr, "Unable to allocate %d bytes for the target buffer!\n", (int)dstbuflen);
3380         free(srcbuf);
33773381         return 1;
33783382      }
33793383      dstbuflen = jedbin_output(&jed, dstbuf, dstbuflen);
r20407r20408
34013405      if (!dstbuf)
34023406      {
34033407         fprintf(stderr, "Unable to allocate %d bytes for the target buffer!\n", (int)dstbuflen);
3408         free(srcbuf);
34043409         return 1;
34053410      }
34063411      dstbuflen = jed_output(&jed, dstbuf, dstbuflen);
r20407r20408
34083413
34093414   /* write the destination file */
34103415   err = write_dest_file(dstfile);
3416   free(srcbuf);
34113417   if (err != 0)
34123418      return 1;
34133419
r20407r20408
34533459   /* read the source file */
34543460   err = read_source_file(srcfile);
34553461   if (err != 0)
3462   {
3463      free(srcbuf);
34563464      return 1;
3465   }
34573466
34583467   /* if the source is JED, convert to binary */
34593468   if (is_jed)
r20407r20408
34883497   else
34893498   {
34903499      fprintf(stderr, "Viewing product terms not supported for this pal type.");
3491
3500      free(srcbuf);
34923501      return 1;
34933502   }
34943503
3504   free(srcbuf);
34953505   return 0;
34963506}
34973507

Previous 199869 Revisions Next


© 1997-2024 The MAME Team