diff options
author | Jordan Augé <jordan.auge+fdio@cisco.com> | 2019-11-05 12:28:49 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@fd.io> | 2019-11-05 12:28:49 +0000 |
commit | 8adda70cd102a3ea5d91a72aecfde7107dd0c807 (patch) | |
tree | 7fcf5a6644d51ce1ab459fe2bd2888aea39c7b51 /ctrl/facemgr/src/interfaces | |
parent | 9793bd7849975399ca103480ab946669888080a8 (diff) | |
parent | 29bb779084d76fb31e1b5dfbf54995918d02fc0e (diff) |
Merge "[HICN-372] Code clean up"
Diffstat (limited to 'ctrl/facemgr/src/interfaces')
-rw-r--r-- | ctrl/facemgr/src/interfaces/hicn_light/hicn_light.c | 1 | ||||
-rw-r--r-- | ctrl/facemgr/src/interfaces/updown/updown.c | 12 |
2 files changed, 9 insertions, 4 deletions
diff --git a/ctrl/facemgr/src/interfaces/hicn_light/hicn_light.c b/ctrl/facemgr/src/interfaces/hicn_light/hicn_light.c index e8f168706..82d4a7e6e 100644 --- a/ctrl/facemgr/src/interfaces/hicn_light/hicn_light.c +++ b/ctrl/facemgr/src/interfaces/hicn_light/hicn_light.c @@ -242,7 +242,6 @@ int hl_on_event(interface_t * interface, const facelet_t * facelet) if (!data->s) { /* We are not connected to the forwarder */ goto ERR; - } switch(facelet_get_event(facelet)) { diff --git a/ctrl/facemgr/src/interfaces/updown/updown.c b/ctrl/facemgr/src/interfaces/updown/updown.c index 6a7ab83f4..b804cdac1 100644 --- a/ctrl/facemgr/src/interfaces/updown/updown.c +++ b/ctrl/facemgr/src/interfaces/updown/updown.c @@ -53,7 +53,7 @@ int updown_initialize(interface_t * interface, void * cfg) data->fd = socket(AF_UNIX, SOCK_STREAM, 0); if (data->fd == -1) { perror("socket error"); - return -1; + goto ERR_SOCKET; } memset(&addr, 0, sizeof(addr)); @@ -67,7 +67,7 @@ int updown_initialize(interface_t * interface, void * cfg) if (connect(data->fd, (struct sockaddr*)&addr, sizeof(addr)) == -1) { perror("connect error"); - return -1; + goto ERR_CONNECT; } if (interface_register_fd(interface, data->fd, NULL) < 0) { @@ -77,6 +77,11 @@ int updown_initialize(interface_t * interface, void * cfg) return 0; +ERR_FD: +ERR_CONNECT: + close(data->fd); +ERR_SOCKET: + free(data); ERR_MALLOC: return -1; } @@ -87,11 +92,12 @@ int updown_finalize(interface_t * interface) if (data->fd > 0) close(data->fd); + free(data); return 0; } -int updown_callback(interface_t * interface) +int updown_callback(interface_t * interface, int fd, void * unused) { updown_data_t * data = (updown_data_t*)interface->data; char buf[100]; |