Message ID | 1584487915-19859-2-git-send-email-u9012063@gmail.com |
---|---|
State | Accepted |
Commit | fce16ca1dd308a2c1987b1c5f0f5800ddb6e891b |
Headers | show |
Series | [ovs-dev] ofp-actions: Fix memory leak. | expand |
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>
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
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"); }
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(+)