Hello,
it seems that in function HTTPClient_connect is a bug.
In case that exSecParams is NULL and cli->secAttribs is NULL (during first connection to server), the structure secAttribs is not allocated (just set to NULL and the memory after this pointer is used as the content of the structure later on). So in best case there are 0 in the memory and nothing goes wrong. But what happened in our case - payload was NULL and payloadLen was 1. Which ended up in fatal error in NWP.
So I modified this code:
SlNetSockSecAttrib_t *secAttribs = NULL; if (exSecParams != NULL) { ... } else if (cli->secAttribs != NULL) { ... }
To this code
SlNetSockSecAttrib_t *secAttribs = NULL; if (exSecParams != NULL) { ... } else if (cli->secAttribs != NULL) { ... } else { secAttribs = (SlNetSockSecAttrib_t *)calloc(1, sizeof(SlNetSockSecAttrib_t)); }
I have two questions:
1) Can you confirm the fix is right?
2) Do I need to clean (free) the secAttribs later, or if its already done by some other functions?
Igor