print: Fix "possible leak" warning by moving initialization
For some reason static checkers report that the auto-free is not run if the goto exists the loop. It seems to me like that should work fine, but we can simply make the analysers happy by moving it.
This commit is contained in:
parent
87c3b9c5ba
commit
6e30a1ee45
1 changed files with 2 additions and 1 deletions
|
@ -822,7 +822,7 @@ fp_print_deserialize (const guchar *data,
|
||||||
fpi_print_set_type (result, FPI_PRINT_NBIS);
|
fpi_print_set_type (result, FPI_PRINT_NBIS);
|
||||||
for (i = 0; i < g_variant_n_children (prints); i++)
|
for (i = 0; i < g_variant_n_children (prints); i++)
|
||||||
{
|
{
|
||||||
g_autofree struct xyt_struct *xyt = g_new0 (struct xyt_struct, 1);
|
g_autofree struct xyt_struct *xyt = NULL;
|
||||||
const gint32 *xcol, *ycol, *thetacol;
|
const gint32 *xcol, *ycol, *thetacol;
|
||||||
gsize xlen, ylen, thetalen;
|
gsize xlen, ylen, thetalen;
|
||||||
g_autoptr(GVariant) xyt_data = NULL;
|
g_autoptr(GVariant) xyt_data = NULL;
|
||||||
|
@ -848,6 +848,7 @@ fp_print_deserialize (const guchar *data,
|
||||||
if (xlen > G_N_ELEMENTS (xyt->xcol))
|
if (xlen > G_N_ELEMENTS (xyt->xcol))
|
||||||
goto invalid_format;
|
goto invalid_format;
|
||||||
|
|
||||||
|
xyt = g_new0 (struct xyt_struct, 1);
|
||||||
xyt->nrows = xlen;
|
xyt->nrows = xlen;
|
||||||
memcpy (xyt->xcol, xcol, sizeof (xcol[0]) * xlen);
|
memcpy (xyt->xcol, xcol, sizeof (xcol[0]) * xlen);
|
||||||
memcpy (xyt->ycol, ycol, sizeof (xcol[0]) * xlen);
|
memcpy (xyt->ycol, ycol, sizeof (xcol[0]) * xlen);
|
||||||
|
|
Loading…
Reference in a new issue