diff --git a/srcpkgs/noice/patches/0001-Fix-regex-memory-leak.patch b/srcpkgs/noice/patches/0001-Fix-regex-memory-leak.patch new file mode 100644 index 00000000000..60054214ada --- /dev/null +++ b/srcpkgs/noice/patches/0001-Fix-regex-memory-leak.patch @@ -0,0 +1,100 @@ +From 7136d6b548055cdb9ce9d9aa5f5f12c9d6e6ead5 Mon Sep 17 00:00:00 2001 +From: Nathan Owens +Date: Tue, 1 Jan 2019 06:46:10 -0600 +Subject: [PATCH] Fix regex memory leak + +--- + noice.c | 33 ++++++++++++++++++++++++++++----- + 1 file changed, 28 insertions(+), 5 deletions(-) + +diff --git noice.c noice.c +index 2dc895d..8bc57de 100644 +--- noice.c ++++ noice.c +@@ -38,6 +38,7 @@ + #define MIN(x, y) ((x) < (y) ? (x) : (y)) + #define ISODD(x) ((x) & 1) + #define CONTROL(c) ((c) ^ 0x40) ++#define META(c) ((c) ^ 0x80) + + struct assoc { + char *regex; /* Regex to match on filename */ +@@ -213,8 +214,10 @@ openwith(char *file) + continue; + if (regexec(®ex, file, 0, NULL, 0) == 0) { + bin = assocs[i].bin; ++ regfree(®ex); + break; + } ++ regfree(®ex); + } + DPRINTF_S(bin); + return bin; +@@ -238,6 +241,12 @@ setfilter(regex_t *regex, char *filter) + return r; + } + ++void ++freefilter(regex_t *regex) ++{ ++ regfree(regex); ++} ++ + void + initfilter(int dot, char **ifilter) + { +@@ -327,18 +336,28 @@ printprompt(char *str) + printw(str); + } + +-/* Returns SEL_* if key is bound and 0 otherwise. +- * Also modifies the run and env pointers (used on SEL_{RUN,RUNARG}) */ +-int +-nextsel(char **run, char **env) ++int xgetch(void) + { +- int c, i; ++ int c; + + c = getch(); + if (c == -1) + idle++; + else + idle = 0; ++ return c; ++} ++ ++/* Returns SEL_* if key is bound and 0 otherwise. ++ * Also modifies the run and env pointers (used on SEL_{RUN,RUNARG}) */ ++int ++nextsel(char **run, char **env) ++{ ++ int c, i; ++ ++ c = xgetch(); ++ if (c == 033) ++ c = META(xgetch()); + + for (i = 0; i < LEN(bindings); i++) + if (c == bindings[i].sym) { +@@ -520,6 +539,9 @@ populate(char *path, char *oldpath, char *fltr) + dents = NULL; + + ndents = dentfill(path, &dents, visible, &re); ++ freefilter(&re); ++ if (ndents == 0) ++ return 0; /* Empty result */ + + qsort(dents, ndents, sizeof(*dents), entrycmp); + +@@ -677,6 +699,7 @@ nochange: + r = setfilter(&re, tmp); + if (r != 0) + goto nochange; ++ freefilter(&re); + strlcpy(fltr, tmp, sizeof(fltr)); + DPRINTF_S(fltr); + /* Save current */ +-- +2.20.1 + diff --git a/srcpkgs/noice/template b/srcpkgs/noice/template index 733e2387520..809a29b41cb 100644 --- a/srcpkgs/noice/template +++ b/srcpkgs/noice/template @@ -1,13 +1,13 @@ # Template file for 'noice' pkgname=noice version=0.6 -revision=2 +revision=3 build_style=gnu-makefile make_install_args="MANPREFIX=/usr/share/man" makedepends="ncurses-devel" short_desc="Small file browser" maintainer="Juan RP " -license="BSD" +license="BSD-2-Clause" homepage="http://git.2f30.org/noice" distfiles="http://dl.2f30.org/releases/${pkgname}-${version}.tar.gz" checksum=1996e71dd309f83bd2f892b996fa0c2c481949d2e3dd49e4f7649a1fce5ab351