]> wimlib.net Git - wimlib/commitdiff
update_image.c: check malloc return value
authorEric Biggers <ebiggers3@gmail.com>
Fri, 26 Jul 2019 05:11:33 +0000 (22:11 -0700)
committerEric Biggers <ebiggers3@gmail.com>
Fri, 26 Jul 2019 05:11:33 +0000 (22:11 -0700)
src/update_image.c

index 2247a7f6840307751936b69f6ad618c30ecabf2a..f4affbddcd309ab986897d449da017fcdf9ba785 100644 (file)
@@ -742,9 +742,12 @@ get_capture_config(const tchar *config_file, struct capture_config *config,
 
                size_t len = tstrlen(fs_source_path) +
                             tstrlen(wimboot_cfgfile);
 
                size_t len = tstrlen(fs_source_path) +
                             tstrlen(wimboot_cfgfile);
-               tmp_config_file = MALLOC((len + 1) * sizeof(tchar));
                struct stat st;
 
                struct stat st;
 
+               tmp_config_file = MALLOC((len + 1) * sizeof(tchar));
+               if (!tmp_config_file)
+                       return WIMLIB_ERR_NOMEM;
+
                tsprintf(tmp_config_file, T("%"TS"%"TS),
                         fs_source_path, wimboot_cfgfile);
                if (!tstat(tmp_config_file, &st)) {
                tsprintf(tmp_config_file, T("%"TS"%"TS),
                         fs_source_path, wimboot_cfgfile);
                if (!tstat(tmp_config_file, &st)) {