diff options
Diffstat (limited to 'xdelta3')
-rwxr-xr-x | xdelta3/xdelta3-main.h | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/xdelta3/xdelta3-main.h b/xdelta3/xdelta3-main.h index 5d8b51e..1552809 100755 --- a/xdelta3/xdelta3-main.h +++ b/xdelta3/xdelta3-main.h | |||
@@ -2823,9 +2823,12 @@ setup_environment (int argc, | |||
2823 | if (v == NULL) { | 2823 | if (v == NULL) { |
2824 | (*argc_out) = argc; | 2824 | (*argc_out) = argc; |
2825 | (*argv_out) = argv; | 2825 | (*argv_out) = argv; |
2826 | (*argv_free) = NULL; | ||
2827 | (*env_free) = NULL; | ||
2826 | return; | 2828 | return; |
2827 | } | 2829 | } |
2828 | *env_free = main_malloc(strlen(v) + 1); | 2830 | |
2831 | (*env_free) = main_malloc(strlen(v) + 1); | ||
2829 | strcpy(*env_free, v); | 2832 | strcpy(*env_free, v); |
2830 | 2833 | ||
2831 | /* Space needed for new argv: count spaces */ | 2834 | /* Space needed for new argv: count spaces */ |
@@ -2837,7 +2840,8 @@ setup_environment (int argc, | |||
2837 | } | 2840 | } |
2838 | 2841 | ||
2839 | (*argc_out) = n; | 2842 | (*argc_out) = n; |
2840 | (*argv_out) = main_malloc(sizeof(char*) * (n + 1)); | 2843 | (*argv_free) = main_malloc(sizeof(char*) * (n + 1)); |
2844 | (*argv_out) = (*argv_free); | ||
2841 | (*argv_out)[0] = argv[0]; | 2845 | (*argv_out)[0] = argv[0]; |
2842 | (*argv_out)[n] = NULL; | 2846 | (*argv_out)[n] = NULL; |
2843 | 2847 | ||
@@ -2877,8 +2881,8 @@ main (int argc, char **argv) | |||
2877 | char *sfilename; | 2881 | char *sfilename; |
2878 | int env_argc; | 2882 | int env_argc; |
2879 | char **env_argv; | 2883 | char **env_argv; |
2880 | char **free_argv = NULL; /* malloced */ | 2884 | char **free_argv; /* malloced */ |
2881 | char *free_value = NULL; /* malloced */ | 2885 | char *free_value; /* malloced */ |
2882 | int ret; | 2886 | int ret; |
2883 | 2887 | ||
2884 | #ifdef _WIN32 | 2888 | #ifdef _WIN32 |
@@ -2892,8 +2896,10 @@ main (int argc, char **argv) | |||
2892 | reset_defaults(); | 2896 | reset_defaults(); |
2893 | 2897 | ||
2894 | go: /* Go. */ | 2898 | go: /* Go. */ |
2895 | cmd = CMD_NONE; | 2899 | free_argv = NULL; |
2900 | free_value = NULL; | ||
2896 | setup_environment(argc, argv, &env_argc, &env_argv, &free_argv, &free_value); | 2901 | setup_environment(argc, argv, &env_argc, &env_argv, &free_argv, &free_value); |
2902 | cmd = CMD_NONE; | ||
2897 | sfilename = NULL; | 2903 | sfilename = NULL; |
2898 | my_optind = 1; | 2904 | my_optind = 1; |
2899 | argv = env_argv; | 2905 | argv = env_argv; |
@@ -3227,11 +3233,11 @@ main (int argc, char **argv) | |||
3227 | main_file_cleanup (& ofile); | 3233 | main_file_cleanup (& ofile); |
3228 | main_file_cleanup (& sfile); | 3234 | main_file_cleanup (& sfile); |
3229 | 3235 | ||
3230 | main_cleanup (); | ||
3231 | |||
3232 | main_free (free_argv); | 3236 | main_free (free_argv); |
3233 | main_free (free_value); | 3237 | main_free (free_value); |
3234 | 3238 | ||
3239 | main_cleanup (); | ||
3240 | |||
3235 | if (--option_profile_cnt > 0 && ret == EXIT_SUCCESS) { goto go; } | 3241 | if (--option_profile_cnt > 0 && ret == EXIT_SUCCESS) { goto go; } |
3236 | 3242 | ||
3237 | fflush (stdout); | 3243 | fflush (stdout); |