comparison src/ex_cmds.c @ 30902:bea05c84b2ad v9.0.0785

patch 9.0.0785: memory leak with empty shell command Commit: https://github.com/vim/vim/commit/9652249a2d02318a28a63a7b5711f25652e8f969 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Oct 17 20:00:26 2022 +0100 patch 9.0.0785: memory leak with empty shell command Problem: Memory leak with empty shell command. Solution: Free the allocated memory when bailing out.
author Bram Moolenaar <Bram@vim.org>
date Mon, 17 Oct 2022 21:15:03 +0200
parents 2ee5b79038f0
children 22264b648b5d
comparison
equal deleted inserted replaced
30901:a3cfcfad21d6 30902:bea05c84b2ad
958 } while (trailarg != NULL); 958 } while (trailarg != NULL);
959 959
960 // Don't do anything if there is no command as there isn't really anything 960 // Don't do anything if there is no command as there isn't really anything
961 // useful in running "sh -c ''". Avoids changing "prevcmd". 961 // useful in running "sh -c ''". Avoids changing "prevcmd".
962 if (STRLEN(newcmd) == 0) 962 if (STRLEN(newcmd) == 0)
963 {
964 vim_free(newcmd);
963 return; 965 return;
966 }
964 967
965 vim_free(prevcmd); 968 vim_free(prevcmd);
966 prevcmd = newcmd; 969 prevcmd = newcmd;
967 970
968 if (bangredo) // put cmd in redo buffer for ! command 971 if (bangredo) // put cmd in redo buffer for ! command