shithub: choc

Download patch

ref: 1524b8f82b161377bbacc86390d54f22e8cd35b3
parent: 6cabdf8774d15c58e1ddb5d6dd95c69c4763ee46
author: Turo Lamminen <turotl@gmail.com>
date: Sat Jul 21 12:52:54 EDT 2018

wad: Free results of D_TryFindWADByName in W_ParseCommandLine

--- a/src/w_main.c
+++ b/src/w_main.c
@@ -16,6 +16,8 @@
 //     Common code to parse command line, identifying WAD files to load.
 //
 
+#include <stdlib.h>
+
 #include "config.h"
 #include "d_iwad.h"
 #include "i_system.h"
@@ -57,6 +59,7 @@
 
             printf(" merging %s\n", filename);
             W_MergeFile(filename);
+            free(filename);
         }
     }
 
@@ -85,6 +88,7 @@
 
             printf(" performing NWT-style merge of %s\n", filename);
             W_NWTDashMerge(filename);
+            free(filename);
         }
     }
     
@@ -112,6 +116,7 @@
 
             printf(" merging flats from %s\n", filename);
             W_NWTMergeFile(filename, W_NWT_MERGE_FLATS);
+            free(filename);
         }
     }
 
@@ -136,6 +141,7 @@
 
             printf(" merging sprites from %s\n", filename);
             W_NWTMergeFile(filename, W_NWT_MERGE_SPRITES);
+            free(filename);
         }
     }
 
@@ -160,6 +166,7 @@
 
             printf(" merging sprites and flats from %s\n", filename);
             W_NWTMergeFile(filename, W_NWT_MERGE_SPRITES | W_NWT_MERGE_FLATS);
+            free(filename);
         }
     }
 
@@ -184,6 +191,7 @@
 
             printf(" adding %s\n", filename);
 	    W_AddFile(filename);
+            free(filename);
         }
     }