[ovs-dev] ofp-actions: Fix memory leak.
diff mbox series

Message ID 1584487915-19859-2-git-send-email-u9012063@gmail.com
State New
Headers show
Series
  • [ovs-dev] ofp-actions: Fix memory leak.
Related show

Commit Message

William Tu March 17, 2020, 11:31 p.m. UTC
Coverity CID 279274 reports leaking previously allocated
'error' buffer when 'return xasprintf("input too big");'.

Cc: Usman Ansari <uansari@vmware.com>
Signed-off-by: William Tu <u9012063@gmail.com>
---
 lib/ofp-actions.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Greg Rose March 18, 2020, 2:48 p.m. UTC | #1
On 3/17/2020 4:31 PM, William Tu wrote:
> Coverity CID 279274 reports leaking previously allocated
> 'error' buffer when 'return xasprintf("input too big");'.
> 
> Cc: Usman Ansari <uansari@vmware.com>
> Signed-off-by: William Tu <u9012063@gmail.com>
> ---
>   lib/ofp-actions.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/lib/ofp-actions.c b/lib/ofp-actions.c
> index ddef3b0c8780..ef8b2b4527f9 100644
> --- a/lib/ofp-actions.c
> +++ b/lib/ofp-actions.c
> @@ -6657,6 +6657,7 @@ parse_CT(char *arg, const struct ofpact_parse_params *pp)
>       }
>   
>       if (ofpbuf_oversized(pp->ofpacts)) {
> +        free(error);
>           return xasprintf("input too big");
>       }
>   
> 

Reviewed-by: Greg Rose <gvrose8192@gmail.com>
William Tu March 20, 2020, 3:44 p.m. UTC | #2
On Wed, Mar 18, 2020 at 07:48:56AM -0700, Gregory Rose wrote:
> 
> 
> On 3/17/2020 4:31 PM, William Tu wrote:
> >Coverity CID 279274 reports leaking previously allocated
> >'error' buffer when 'return xasprintf("input too big");'.
> >
> >Cc: Usman Ansari <uansari@vmware.com>
> >Signed-off-by: William Tu <u9012063@gmail.com>
> >---
> >  lib/ofp-actions.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> >diff --git a/lib/ofp-actions.c b/lib/ofp-actions.c
> >index ddef3b0c8780..ef8b2b4527f9 100644
> >--- a/lib/ofp-actions.c
> >+++ b/lib/ofp-actions.c
> >@@ -6657,6 +6657,7 @@ parse_CT(char *arg, const struct ofpact_parse_params *pp)
> >      }
> >      if (ofpbuf_oversized(pp->ofpacts)) {
> >+        free(error);
> >          return xasprintf("input too big");
> >      }
> >
> 
> Reviewed-by: Greg Rose <gvrose8192@gmail.com>

Thanks for your review, I applied to master and 2.13.
William

Patch
diff mbox series

diff --git a/lib/ofp-actions.c b/lib/ofp-actions.c
index ddef3b0c8780..ef8b2b4527f9 100644
--- a/lib/ofp-actions.c
+++ b/lib/ofp-actions.c
@@ -6657,6 +6657,7 @@  parse_CT(char *arg, const struct ofpact_parse_params *pp)
     }
 
     if (ofpbuf_oversized(pp->ofpacts)) {
+        free(error);
         return xasprintf("input too big");
     }