Fixed crash in FreeBSD.
authorrodin <rodin@ddfedd41-794f-dd11-ae45-00112f111e67>
Fri, 5 Jun 2009 10:27:38 +0000 (10:27 +0000)
committerrodin <rodin@ddfedd41-794f-dd11-ae45-00112f111e67>
Fri, 5 Jun 2009 10:27:38 +0000 (10:27 +0000)
There was no reason to assume the argument list would be null terminated.

libchimara/chimara-glk.c

index 00cc8b4c6b11e191957b5277a60b3bcc48aa8542..bf0e60b7fc72cc2fd332de6be14dc406792df88d 100644 (file)
@@ -995,9 +995,9 @@ chimara_glk_run(ChimaraGlk *glk, gchar *plugin, int argc, char *argv[], GError *
                startup_succeeded = glkunix_startup_code(&data);
                priv->in_startup = FALSE;
                
-               gchar **ptr = data.argv;
-               while(*ptr++)
-                       g_free(*ptr);
+               int i=0;
+               while(i < data.argc)
+                       g_free(data.argv[i++]);
                g_free(data.argv);
                
                if(!startup_succeeded)