fixed crash when passing the -screen argument, due to trying to free the
[vrtris] / src / opt.c
index 33d7dfb..acce25f 100644 (file)
--- a/src/opt.c
+++ b/src/opt.c
@@ -38,6 +38,11 @@ int init_options(int argc, char **argv, const char *cfgfile)
 
        /* default options */
        opt = def_opt;
+       if(!(opt.start_scr = malloc(strlen(def_opt.start_scr) + 1))) {
+               perror("failed to allocate memory");
+               return -1;
+       }
+       strcpy(opt.start_scr, def_opt.start_scr);
 
        argv0 = argv[0];