forked from 12to11/12to11
Pacify more compiler warnings
* text_input.c (EncodeIMString): * xdata.c (GetConversionCallback, PostReceiveConversion): Pacify GCC suspecting memory leaks after iconv_open returns -1.
This commit is contained in:
parent
69e0902cfc
commit
d2abef20c4
2 changed files with 23 additions and 0 deletions
|
@ -2222,12 +2222,19 @@ EncodeIMString (const char *input, size_t input_size, int *chars)
|
||||||
/* If creating the cd failed, bail out. */
|
/* If creating the cd failed, bail out. */
|
||||||
if (cd == (iconv_t) -1)
|
if (cd == (iconv_t) -1)
|
||||||
{
|
{
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wanalyzer-malloc-leak"
|
||||||
|
#endif
|
||||||
/* Restore the old locale. */
|
/* Restore the old locale. */
|
||||||
if (!setlocale (LC_CTYPE, oldlocale))
|
if (!setlocale (LC_CTYPE, oldlocale))
|
||||||
abort ();
|
abort ();
|
||||||
|
|
||||||
XLFree (oldlocale);
|
XLFree (oldlocale);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Otherwise, start converting. */
|
/* Otherwise, start converting. */
|
||||||
|
|
16
xdata.c
16
xdata.c
|
@ -1691,11 +1691,20 @@ GetConversionCallback (WriteTransfer *transfer, Atom target, Atom *type,
|
||||||
|
|
||||||
cd = iconv_open ("ISO-8859-1", "UTF-8");
|
cd = iconv_open ("ISO-8859-1", "UTF-8");
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wanalyzer-malloc-leak"
|
||||||
|
#endif
|
||||||
|
|
||||||
if (cd == (iconv_t) -1)
|
if (cd == (iconv_t) -1)
|
||||||
/* The conversion context couldn't be initialized, so fail this
|
/* The conversion context couldn't be initialized, so fail this
|
||||||
transfer. */
|
transfer. */
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
#endif
|
||||||
|
|
||||||
/* First, create a non-blocking pipe. We will give the write end to
|
/* First, create a non-blocking pipe. We will give the write end to
|
||||||
the client. */
|
the client. */
|
||||||
rc = pipe2 (pipe, O_NONBLOCK);
|
rc = pipe2 (pipe, O_NONBLOCK);
|
||||||
|
@ -1885,10 +1894,17 @@ PostReceiveConversion (Time time, Atom selection, Atom target, int fd)
|
||||||
|
|
||||||
if (cd == (iconv_t) -1)
|
if (cd == (iconv_t) -1)
|
||||||
{
|
{
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wanalyzer-malloc-leak"
|
||||||
|
#endif
|
||||||
/* The conversion context couldn't be created. Close the file
|
/* The conversion context couldn't be created. Close the file
|
||||||
descriptor and fail. */
|
descriptor and fail. */
|
||||||
close (fd);
|
close (fd);
|
||||||
return;
|
return;
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
info = XLCalloc (1, sizeof *info);
|
info = XLCalloc (1, sizeof *info);
|
||||||
|
|
Loading…
Add table
Reference in a new issue