Fix some memory leaks in the core.

Also removes a redundant if statement

In regards to why it's redundant, see the original function with comments pointing out the redundancy:

```
static bool set_direct_pix_conv(struct scaler_ctx *ctx)
{
   if (ctx->in_fmt == ctx->out_fmt)
      ctx->direct_pixconv = conv_copy;
   else if (ctx->in_fmt == SCALER_FMT_0RGB1555 && ctx->out_fmt == SCALER_FMT_ARGB8888)
      ctx->direct_pixconv = conv_0rgb1555_argb8888;
   else if (ctx->in_fmt == SCALER_FMT_RGB565 && ctx->out_fmt == SCALER_FMT_ARGB8888)
      ctx->direct_pixconv = conv_rgb565_argb8888;
   else if (ctx->in_fmt == SCALER_FMT_RGB565 && ctx->out_fmt == SCALER_FMT_BGR24) // Here
      ctx->direct_pixconv = conv_rgb565_bgr24;
   else if (ctx->in_fmt == SCALER_FMT_0RGB1555 && ctx->out_fmt == SCALER_FMT_RGB565)
      ctx->direct_pixconv = conv_0rgb1555_rgb565;
   else if (ctx->in_fmt == SCALER_FMT_RGB565 && ctx->out_fmt == SCALER_FMT_0RGB1555)
      ctx->direct_pixconv = conv_rgb565_0rgb1555;
   else if (ctx->in_fmt == SCALER_FMT_BGR24 && ctx->out_fmt == SCALER_FMT_ARGB8888)
      ctx->direct_pixconv = conv_bgr24_argb8888;
   else if (ctx->in_fmt == SCALER_FMT_ARGB8888 && ctx->out_fmt == SCALER_FMT_0RGB1555)
      ctx->direct_pixconv = conv_argb8888_0rgb1555;
   else if (ctx->in_fmt == SCALER_FMT_ARGB8888 && ctx->out_fmt == SCALER_FMT_BGR24)
      ctx->direct_pixconv = conv_argb8888_bgr24;
   else if (ctx->in_fmt == SCALER_FMT_0RGB1555 && ctx->out_fmt == SCALER_FMT_BGR24)
      ctx->direct_pixconv = conv_0rgb1555_bgr24;
   else if (ctx->in_fmt == SCALER_FMT_RGB565 && ctx->out_fmt == SCALER_FMT_BGR24) // And here
      ctx->direct_pixconv = conv_rgb565_bgr24;
   else if (ctx->in_fmt == SCALER_FMT_ARGB8888 && ctx->out_fmt == SCALER_FMT_ABGR8888)
      ctx->direct_pixconv = conv_argb8888_abgr8888;
   else
      return false;

   return true;
}
```


Also fixes issue #334 and issue #335