From: Vincent Bernat Date: Fri, 3 Oct 2014 11:40:25 +0000 (+0200) Subject: lib: don't check for NULL before free X-Git-Tag: 0.7.11~12 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d2badd57c3b6281108fd617bda702c45ec0484c6;p=thirdparty%2Flldpd.git lib: don't check for NULL before free --- 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. */