Mercurial > vim
comparison src/search.c @ 20653:a68591fbb93d v8.2.0880
patch 8.2.0880: leaking memory when using searchcount()
Commit: https://github.com/vim/vim/commit/109aece79d1b5f14f6a84ff2ac068cfffebeba80
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Jun 1 19:08:54 2020 +0200
patch 8.2.0880: leaking memory when using searchcount()
Problem: Leaking memory when using searchcount().
Solution: Free the last used search pattern.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 01 Jun 2020 19:15:03 +0200 |
parents | 3e03edae7e6f |
children | c7843f009ecf |
comparison
equal
deleted
inserted
replaced
20652:a0550466b57b | 20653:a68591fbb93d |
---|---|
4145 save_last_search_pattern(); | 4145 save_last_search_pattern(); |
4146 if (pattern != NULL) | 4146 if (pattern != NULL) |
4147 { | 4147 { |
4148 if (*pattern == NUL) | 4148 if (*pattern == NUL) |
4149 goto the_end; | 4149 goto the_end; |
4150 vim_free(spats[last_idx].pat); | |
4150 spats[last_idx].pat = vim_strsave(pattern); | 4151 spats[last_idx].pat = vim_strsave(pattern); |
4151 } | 4152 } |
4152 if (spats[last_idx].pat == NULL || *spats[last_idx].pat == NUL) | 4153 if (spats[last_idx].pat == NULL || *spats[last_idx].pat == NUL) |
4153 goto the_end; // the previous pattern was never defined | 4154 goto the_end; // the previous pattern was never defined |
4154 | 4155 |