]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
lib: don't check for NULL before free
authorVincent Bernat <vincent@bernat.im>
Fri, 3 Oct 2014 11:40:25 +0000 (13:40 +0200)
committerVincent Bernat <vincent@bernat.im>
Fri, 3 Oct 2014 11:40:25 +0000 (13:40 +0200)
src/lib/atom.c
src/lib/private.h

index a7b600770a5426c26f0970068fd65c169903e3ed..c592ff92f752d3ad0144f7ab728ad33c88ce3d8f 100644 (file)
@@ -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
index d33629376ccb6438d4886149a826b3819b77695a..370aa915fc736546c529d06be2e07a1eca075921 100644 (file)
@@ -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. */