From: Paul Moore <[email protected]>

Signed-off-by: Paul Moore <[email protected]>
---
 src/gen_bpf.c |   16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/gen_bpf.c b/src/gen_bpf.c
index 54df2ef6..0b6e95a4 100644
--- a/src/gen_bpf.c
+++ b/src/gen_bpf.c
@@ -1945,22 +1945,22 @@ struct bpf_program *gen_bpf_generate(const struct 
db_filter_col *col)
 {
        int rc;
        struct bpf_state state;
+       struct bpf_program *prgm;
 
        memset(&state, 0, sizeof(state));
        state.attr = &col->attr;
 
-       state.bpf = zmalloc(sizeof(*(state.bpf)));
-       if (state.bpf == NULL)
+       prgm = zmalloc(sizeof(*(prgm)));
+       if (prgm == NULL)
                return NULL;
+       state.bpf = prgm;
 
        rc = _gen_bpf_build_bpf(&state, col);
-       if (rc < 0)
-               goto bpf_generate_end;
+       if (rc == 0)
+               state.bpf = NULL;
+       _state_release(&state);
 
-bpf_generate_end:
-       if (rc < 0)
-               _state_release(&state);
-       return state.bpf;
+       return prgm;
 }
 
 /**

-- 
You received this message because you are subscribed to the Google Groups 
"libseccomp" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to