diff options
| author | Syndamia <kamen@syndamia.com> | 2023-12-08 18:25:01 +0200 |
|---|---|---|
| committer | Syndamia <kamen@syndamia.com> | 2023-12-08 18:25:01 +0200 |
| commit | 52355a5cd5e451c2bf4f969c039e529eb6245a8e (patch) | |
| tree | 11044841940c0b9b320bfc61b7e80c84c06095dd /util.c | |
| parent | 60a717a163c4819d61e6bd1edd77e10c1b400e44 (diff) | |
| download | pico-web-52355a5cd5e451c2bf4f969c039e529eb6245a8e.tar pico-web-52355a5cd5e451c2bf4f969c039e529eb6245a8e.tar.gz pico-web-52355a5cd5e451c2bf4f969c039e529eb6245a8e.zip | |
[browser] Fixed memory leaks and did slight reorganizing
Diffstat (limited to 'util.c')
| -rw-r--r-- | util.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -104,8 +104,11 @@ sds gsub_getm(sds str, const regex_t *regex, const char* repl, int* *matches, in * repl can include matched subexpressions */ for(size_t i = 0; i < replLen; i++) { if (repl[i] <= '\10') { - if (pmatch[repl[i] % 10].rm_so > -1) - ret = sdscatsds(ret, getMatch(MATCHSTART, pmatch[repl[i] % 10])); + if (pmatch[repl[i] % 10].rm_so > -1) { + sds match = getMatch(MATCHSTART, pmatch[repl[i] % 10]); + ret = sdscatsds(ret, match); + sdsfree(match); + } } else ret = sdscatlen(ret, &repl[i], 1); |
