[Spice-devel] [spice-common 2/8] coverity: avoid resource leak

Christophe Fergeau cfergeau at redhat.com
Mon Apr 4 08:22:44 UTC 2016


On Mon, Apr 04, 2016 at 10:03:33AM +0200, Fabiano FidĂȘncio wrote:
> ---
>  common/canvas_base.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/common/canvas_base.c b/common/canvas_base.c
> index fa4d373..650422b 100644
> --- a/common/canvas_base.c
> +++ b/common/canvas_base.c
> @@ -769,6 +769,7 @@ static inline SpicePalette *canvas_get_localized_palette(CanvasBase *canvas, Spi
>      case SPICE_SURFACE_FMT_16_565:
>      default:
>          spice_warn_if_reached();
> +        free(copy);
>          return NULL;

One could argue that after a spice_warn_if_reached() all bets are off
(ie programming error), but here it's easy to at least avoid the leak

Acked-by: Christophe Fergeau <cfergeau at redhat.com>

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20160404/c20de655/attachment-0001.sig>


More information about the Spice-devel mailing list