diff --git a/irssi-1.1.1-coverity-scan-fixes.patch b/irssi-1.1.1-coverity-scan-fixes.patch
new file mode 100644
index 0000000..7dcecac
--- /dev/null
+++ b/irssi-1.1.1-coverity-scan-fixes.patch
@@ -0,0 +1,25 @@
+diff --git a/src/irc/core/irc-expandos.c b/src/irc/core/irc-expandos.c
+index 62ef577..27f51ca 100644
+--- a/src/irc/core/irc-expandos.c
++++ b/src/irc/core/irc-expandos.c
+@@ -138,7 +138,7 @@ static char *expando_cumode_space(SERVER_REC *server, void *item, int *free_ret)
+                 return "";
+ 
+ 	ret = expando_cumode(server, item, free_ret);
+-	return *ret == '\0' ? " " : ret;
++	return *ret == '\0' ? g_free(ret) , " " : ret;
+ }
+ 
+ static void event_join(IRC_SERVER_REC *server, const char *data,
+diff --git a/src/irc/dcc/dcc-send.c b/src/irc/dcc/dcc-send.c
+index 912129b..5000928 100644
+--- a/src/irc/dcc/dcc-send.c
++++ b/src/irc/dcc/dcc-send.c
+@@ -425,6 +425,7 @@ static int dcc_send_one_file(int queue, const char *target, const char *fname,
+ 	g_free(str);
+ 	if (dcc == NULL) {
+ 		g_warn_if_reached();
++		close(hfile);
+ 		return FALSE;
+ 	}
+ 
diff --git a/irssi.spec b/irssi.spec
index 6e50a50..1872de8 100644
--- a/irssi.spec
+++ b/irssi.spec
@@ -3,7 +3,7 @@
 Summary:	Modular text mode IRC client with Perl scripting
 Name:		irssi
 Version:	1.1.1
-Release:	3%{?dist}
+Release:	4%{?dist}
 
 License:	GPLv2+
 Group:		Applications/Communications
@@ -14,6 +14,7 @@ BuildRequires:	ncurses-devel openssl-devel zlib-devel
 BuildRequires:	pkgconfig glib2-devel perl-devel perl-generators perl(ExtUtils::Embed)
 BuildRequires:	autoconf automake libtool
 Requires:	perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
+Patch0:		irssi-1.1.1-coverity-scan-fixes.patch
 
 %package devel
 Summary:	Development package for irssi
@@ -35,6 +36,7 @@ being maintained.
 
 %prep
 %setup -q
+%patch -p1 -b .coverity-scan-fixes
 
 %build
 autoreconf -i
@@ -81,6 +83,9 @@ chmod -R u+w $RPM_BUILD_ROOT%{perl_vendorarch}
 
 
 %changelog
+* Tue Dec  4 2018 Jaroslav Škarvada <jskarvad@redhat.com> - 1.1.1-4
+- Fixed some issues found by coverity scan
+
 * Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.1-3
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild