struct sframe_decoder_ctx
{
- sframe_header sfd_header; /* SFrame header. */
- uint32_t *sfd_funcdesc; /* SFrame function desc entries table. */
- void *sfd_fres; /* SFrame FRE table. */
- int sfd_fre_nbytes; /* Number of bytes needed for SFrame FREs. */
+ /* SFrame header. */
+ sframe_header sfd_header;
+ /* SFrame function desc entries table. */
+ uint32_t *sfd_funcdesc;
+ /* SFrame FRE table. */
+ void *sfd_fres;
+ /* Number of bytes needed for SFrame FREs. */
+ int sfd_fre_nbytes;
+ /* Reference to the internally malloc'd buffer, if any, for endian flipping
+ the original input buffer before decoding. */
+ void *sfd_buf;
};
struct sframe_encoder_ctx
free (dctx->sfd_fres);
dctx->sfd_fres = NULL;
}
+ if (dctx->sfd_buf != NULL)
+ {
+ free (dctx->sfd_buf);
+ dctx->sfd_buf = NULL;
+ }
free (*decoder);
*decoder = NULL;
return sframe_ret_set_errno (errp, SFRAME_ERR_BUF_INVAL);
}
frame_buf = tempbuf;
+ /* This buffer is malloc'd when endian flipping the contents of the input
+ buffer are needed. Keep a reference to it so it can be free'd up
+ later in sframe_decoder_free (). */
+ dctx->sfd_buf = tempbuf;
}
else
frame_buf = (char *)sf_buf;