From d2badd57c3b6281108fd617bda702c45ec0484c6 Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Fri, 3 Oct 2014 13:40:25 +0200 Subject: [PATCH] lib: don't check for NULL before free --- src/lib/atom.c | 3 +-- src/lib/private.h | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/lib/atom.c b/src/lib/atom.c index a7b60077..c592ff92 100644 --- a/src/lib/atom.c +++ b/src/lib/atom.c @@ -343,8 +343,7 @@ _lldpctl_do_something(lldpctl_conn_t *conn, return SET_ERROR(conn, LLDPCTL_ERR_SERIALIZATION); /* rc == 0 */ conn->state = CONN_STATE_IDLE; - if (conn->state_data) - free(conn->state_data); + free(conn->state_data); conn->state_data = NULL; return 0; } else diff --git a/src/lib/private.h b/src/lib/private.h index d3362937..370aa915 100644 --- a/src/lib/private.h +++ b/src/lib/private.h @@ -50,7 +50,7 @@ struct lldpctl_conn_t { #define CONN_STATE_SET_CONFIG_SEND 10 #define CONN_STATE_SET_CONFIG_RECV 11 int state; /* Current state */ - const char *state_data; /* Data attached to the state. It is used to + char *state_data; /* Data attached to the state. It is used to * check that we are using the same data as a * previous call until the state machine goes to * CONN_STATE_IDLE. */ -- 2.39.5