Index: api/make_app_icon_h.cpp
===================================================================
--- api/make_app_icon_h.cpp	(révision 25749)
+++ api/make_app_icon_h.cpp	(copie de travail)
@@ -41,7 +41,7 @@
     outFile = fopen(argv[2], "w");
     if (inFile == NULL) {
         printf ("Couldn't create output file %s\n", argv[2]);
-        fclose(inFile);
+        fclose(outFile);
         return 0;
     }
     
Index: api/texfont.cpp
===================================================================
--- api/texfont.cpp	(révision 25749)
+++ api/texfont.cpp	(copie de travail)
@@ -389,6 +389,12 @@
 		if (txf->teximage) free(txf->teximage);
 		free(txf);
 	}
+	if (texbitmap) {
+		free(texbitmap);
+	}
+	if (orig) {
+		free(orig);
+	}
 	if (file) fclose(file);
 	return NULL;
 }
Index: api/texture.cpp
===================================================================
--- api/texture.cpp	(révision 25749)
+++ api/texture.cpp	(copie de travail)
@@ -328,7 +328,10 @@
 	fread (&type, sizeof (char), 3, s);  // read in colormap info and image type, byte 0 ignored
     fseek (s, 12, SEEK_SET);			 // seek past the header and useless info
     fread (&info, sizeof (char), 6, s);
-	if (type[1] != 0 || (type[2] != 2 && type[2] != 3)) return NULL;
+	if (type[1] != 0 || (type[2] != 2 && type[2] != 3)) {
+		fclose(s);
+		return NULL;
+	}
 	(*width)  = info[0] + info[1] * 256; 
     (*height) = info[2] + info[3] * 256;
     imageBits =	info[4]; 
Index: api/tgalib.cpp
===================================================================
--- api/tgalib.cpp	(révision 25749)
+++ api/tgalib.cpp	(copie de travail)
@@ -125,8 +125,11 @@
 			}
 		}	
 		// Else return a NULL for a bad or unsupported pixel format
-		else
+		else {
+			free(pImageData);
+			fclose(pFile);
 			return NULL;
+		}
 	}
 	// Else, it must be Run-Length Encoded (RLE)
 	else
Index: vda/vdad.cpp
===================================================================
--- vda/vdad.cpp	(révision 25749)
+++ vda/vdad.cpp	(copie de travail)
@@ -448,7 +448,10 @@
     if (!f) return -1;
     for (int i=0; i<policy.coding_levels; i++) {
         int n = fscanf(f, "%lf\n", &(policy.chunk_sizes[i]));
-        if (n != 1) return -1;
+        if (n != 1) {
+            fclose(f);
+            return -1;
+        }
     }
     fclose(f);
     meta_chunk = new META_CHUNK(this, NULL, 0);
Index: vda/vda_policy.cpp
===================================================================
--- vda/vda_policy.cpp	(révision 25749)
+++ vda/vda_policy.cpp	(copie de travail)
@@ -55,5 +55,6 @@
     }
     sprintf(buf, "X%d", replication);
     strcat(description, buf);
+    fclose(f);
     return 0;
 }
Index: client/hostinfo_unix_test.cpp
===================================================================
--- client/hostinfo_unix_test.cpp	(révision 25749)
+++ client/hostinfo_unix_test.cpp	(copie de travail)
@@ -201,5 +201,6 @@
 
 
     printf("p_vendor: %s\nm_cache: %d\nmodel_buf: %s\n", p_vendor, m_cache, model_buf);
+    fclose(f);
     return 0;
 }
Index: sched/sched_util.cpp
===================================================================
--- sched/sched_util.cpp	(révision 25749)
+++ sched/sched_util.cpp	(copie de travail)
@@ -140,6 +140,7 @@
             return ERR_FOPEN;
         }
     }
+    fclose(f);
     return 0;
 }
 
Index: sched/sched_main.cpp
===================================================================
--- sched/sched_main.cpp	(révision 25749)
+++ sched/sched_main.cpp	(copie de travail)
@@ -446,6 +446,9 @@
             );
         }
 #endif
+       if (stderr_buffer) {
+            free(stderr_buffer);
+       }
     }
 
     srand(time(0)+getpid());
Index: sched/sched_driver.cpp
===================================================================
--- sched/sched_driver.cpp	(révision 25749)
+++ sched/sched_driver.cpp	(copie de travail)
@@ -80,6 +80,7 @@
         strcpy(hd.p_model, p3);
         host_descs.push_back(hd);
     }
+    fclose(f);
 }
 
 inline double req_time() {
Index: sched/feeder.cpp
===================================================================
--- sched/feeder.cpp	(révision 25749)
+++ sched/feeder.cpp	(copie de travail)
@@ -873,6 +873,8 @@
         weighted_interleave(
             weights, ssp->napps, ssp->max_wu_results, app_indices, counts
         );
+        free(weights);
+        free(counts); 
     } else {
         napps = 1;
     }
Index: sched/credit_test.cpp
===================================================================
--- sched/credit_test.cpp	(révision 25749)
+++ sched/credit_test.cpp	(copie de travail)
@@ -351,6 +351,10 @@
     double total_old_credit = 0;
     double total_new_credit = 0;
     FILE* in = fopen("credit_test_data", "r");
+    if (in == NULL) {
+        printf("Impossible to open credit_test_data\n");
+        exit(1);
+    }
     printf("min credit: %f\n", min_credit);
     while (!feof(in)) {
         int c = fscanf(in, "%d %d %d %d %lf %d %lf %lf %lf %lf",
@@ -400,6 +404,7 @@
         }
         if (n >= MAX_JOBS) break;
     }
+    fclose(in);
     fclose(f);
     if (nstats == 0) {
         printf("Insufficient jobs were read from DB\n");
Index: apps/concat.cpp
===================================================================
--- apps/concat.cpp	(révision 25749)
+++ apps/concat.cpp	(copie de travail)
@@ -121,6 +121,7 @@
     if (state) {
         fscanf(state, "%d %d", &file_num, &nchars);
         mode = "a";
+	fclose(state);
     } else {
         file_num = (run_slow ? 2 : 1);
         nchars = 0;
