Commit Diff


commit - 7d36d3a94d71dec034a00e45e226794a81744cfe
commit + 2e272c3132a6f583a268ea0e840f56033f6b155b
blob - 10b3c82cdfa712fc482aa83d8223251b5cd07866
blob + ddf076acfc424ccb927761c608b76df0475423c9
--- pdf.c
+++ pdf.c
@@ -5173,6 +5173,10 @@ main(int argc, char *argv[])
 				    " %" PRId64 " (%#" PRIx64 ")\n",
 				    infile, pos, pos);
 				//h_pprintln(stderr, res->ast);	// XXX debug
+#ifdef LEAKCHECK
+				h_parse_result_free(res);
+				fclose(stdout);			// free buffer
+#endif
 			}
 		}
 
@@ -5202,5 +5206,13 @@ main(int argc, char *argv[])
 		text_extract(&aux, xfile, Xfile);
 	}
 
+#ifdef LEAKCHECK
+	/*
+	 * This is only useful when checking for memory leaks. Otherwise,
+	 * exit() or a return from main() cleans up just fine.
+	 */
+	h_parse_result_free(res);
+	fclose(stdout);			// free buffer
+#endif
 	return 0;
 }