Skip to content

Commit

Permalink
curses ui: add missing iconv_close calls
Browse files Browse the repository at this point in the history
The iconv_t are opened but never closed.

Spotted by Coverity: CID 1399708
Spotted by Coverity: CID 1399709
Spotted by Coverity: CID 1399713

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Message-Id: <20190314172524.9290-1-samuel.thibault@ens-lyon.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
  • Loading branch information
sthibaul authored and kraxel committed Mar 18, 2019
1 parent a5489ae commit a9fda24
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ui/curses.c
Original file line number Diff line number Diff line change
Expand Up @@ -519,13 +519,16 @@ static void font_setup(void)

wchar_to_ucs_conv = iconv_open("UCS-2", "WCHAR_T");
if (wchar_to_ucs_conv == (iconv_t) -1) {
iconv_close(ucs_to_wchar_conv);
fprintf(stderr, "Could not convert font glyphs to UCS-2: '%s'\n",
strerror(errno));
exit(1);
}

font_conv = iconv_open("WCHAR_T", font_charset);
if (font_conv == (iconv_t) -1) {
iconv_close(ucs_to_wchar_conv);
iconv_close(wchar_to_ucs_conv);
fprintf(stderr, "Could not convert font glyphs from %s: '%s'\n",
font_charset, strerror(errno));
exit(1);
Expand Down Expand Up @@ -646,6 +649,9 @@ static void font_setup(void)
}
}
}
iconv_close(ucs_to_wchar_conv);
iconv_close(wchar_to_ucs_conv);
iconv_close(font_conv);
}

static void curses_setup(void)
Expand Down

0 comments on commit a9fda24

Please sign in to comment.