shithub: choc

Download patch

ref: 745e7342badc686f40ee25c2fa211e69924ad938
parent: 94cf1f21d53ccad2bbe97579c2ce685c82999d20
author: Turo Lamminen <[email protected]>
date: Mon Feb 1 10:39:23 EST 2021

Free any old strings in myargv which were not moved to newargv

--- a/src/m_argv.c
+++ b/src/m_argv.c
@@ -214,6 +214,16 @@
         ++newargc;
     }
 
+    // Free any old strings in myargv which were not moved to newargv
+    for (i = 0; i < myargc; ++i)
+    {
+        if (myargv[i] != NULL)
+        {
+            free(myargv[i]);
+            myargv[i] = NULL;
+        }
+    }
+
     free(myargv);
     myargv = newargv;
     myargc = newargc;