shithub: dumb

Download patch

ref: 8b2fadaf5a88171d9d94782c9a28e45f4ed10c92
parent: 9db1273c6431216946c2c30e71e2c90859635744
author: Chris Moeller <[email protected]>
date: Mon Jan 11 03:59:03 EST 2010

{10/30/2005 1:56:28 AM~10/30/2005 1:56:40 AM}

git-tfs-id: [http://localhost:8080/tfs/DefaultCollection/]$/foobar2000/files/plugins.root;C43

--- a/dumb/include/dumb.h
+++ b/dumb/include/dumb.h
@@ -24,6 +24,10 @@
 #include <stdlib.h>
 #include <stdio.h>
 
+#ifdef _DEBUG
+#define _CRTDBG_MAP_ALLOC
+#include <crtdbg.h>
+#endif
 
 #ifdef __cplusplus
 	extern "C" {
--- a/dumb/src/it/readpsm.c
+++ b/dumb/src/it/readpsm.c
@@ -477,7 +477,7 @@
 
 	if (dumbfile_mgetl(f) != DUMB_ID('F','I','L','E')) goto error;
 
-	chunk = malloc(768 * sizeof(*chunk));
+	chunk = calloc(768, sizeof(*chunk));
 
 	while (length >= 8) {
 		chunk[n_chunks].id = dumbfile_mgetl(f);
@@ -489,7 +489,11 @@
 		if (n) {
 			ptr = malloc(n);
 			if (!ptr) goto error_fc;
-			if (dumbfile_getnc(ptr, n, f) < n) goto error_fc;
+			if (dumbfile_getnc(ptr, n, f) < n)
+			{
+				free(ptr);
+				goto error_fc;
+			}
 			chunk[n_chunks].data = ptr;
 		}
 		n_chunks++;
@@ -567,6 +571,7 @@
 			sigdata->n_pchannels = ptr[10];
 			length = c->len - 11;
 			ptr += 11;
+			songchunk = 0;
 			if (length >= 8) {
 				songchunk = malloc(128 * sizeof(*songchunk));
 				if (!songchunk) goto error_usd;
@@ -586,7 +591,7 @@
 		}
 	}
 
-	if (!n_song_chunks) goto error_usd;
+	if (!n_song_chunks) goto error_sc;
 
 	for (n = 0; n < n_song_chunks; n++) {
 		PSMCHUNK * c = &songchunk[n];
@@ -948,7 +953,7 @@
 error_ev:
 	free(event);
 error_sc:
-	free(songchunk);
+	if (songchunk) free(songchunk);
 error_usd:
 	_dumb_it_unload_sigdata(sigdata);
 	goto error_fc;
--- a/dumb/vc6/dumb/dumb.vcproj
+++ b/dumb/vc6/dumb/dumb.vcproj
@@ -193,7 +193,6 @@
 				Name="VCCLCompilerTool"
 				Optimization="2"
 				InlineFunctionExpansion="2"
-				WholeProgramOptimization="true"
 				AdditionalIncludeDirectories="../../include"
 				PreprocessorDefinitions="NDEBUG;WIN32;_LIB;DUMB_DECLARE_DEPRECATED"
 				StringPooling="true"