Message ID | 1509496191-28209-1-git-send-email-u9012063@gmail.com |
---|---|
State | Accepted |
Headers | show |
Series | [ovs-dev,PATCHv2,1/2] ofproto-dpif-xlate: Fix bad memory free. | expand |
diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c index d0b45d233e69..667960d70389 100644 --- a/ofproto/ofproto-dpif-xlate.c +++ b/ofproto/ofproto-dpif-xlate.c @@ -5131,7 +5131,7 @@ xlate_learn_action(struct xlate_ctx *ctx, const struct ofpact_learn *learn) } } - if (ctx->xin->xcache) { + if (ofm != &ofm__) { free(ofm); }
Clang reports possibly bad free of 'ofm' when it comes from the stack instead of malloc because Clang is not able to verify whether the previous if condition 'ctx->xin->xcache' still hold the same. Fix it by adding additional condition. Signed-off-by: William Tu <u9012063@gmail.com> --- ofproto/ofproto-dpif-xlate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)