X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?p=src%2Fapp-framework-binder.git;a=blobdiff_plain;f=src%2Fafb-api-ws.c;h=65daf02575ad5f3b36aaf160fc67ed055d243b59;hp=8069da22bc3f67796cc8a8f94c4b240497335416;hb=bc8929bec96e81a7f487d5689f52335b435f0e3e;hpb=75a6b9e42432e3503a69013624c786af35aed7af diff --git a/src/afb-api-ws.c b/src/afb-api-ws.c index 8069da22..65daf025 100644 --- a/src/afb-api-ws.c +++ b/src/afb-api-ws.c @@ -43,7 +43,7 @@ struct api_ws_server struct afb_apiset *apiset; /* the apiset for calling */ struct fdev *fdev; /* fdev handler */ uint16_t offapi; /* api name of the interface */ - char uri[1]; /* the uri of the server socket */ + char uri[]; /* the uri of the server socket */ }; /******************************************************************************/ @@ -206,7 +206,7 @@ int afb_api_ws_add_server(const char *uri, struct afb_apiset *declare_set, struc /* make the structure */ lapi = strlen(api); extra = luri == (api - uri) + lapi ? 0 : lapi + 1; - apiws = malloc(sizeof * apiws + luri + extra); + apiws = malloc(sizeof * apiws + 1 + luri + extra); if (!apiws) { ERROR("out of memory"); errno = ENOMEM;