-
Notifications
You must be signed in to change notification settings - Fork 634
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
shadow connect possible memory leak #16
Comments
Hi, Rahul |
Thx, looking forward to seeing the changes (I assume they'll solve the problem in a cleaner way compared to my small hack). |
Hi, Rahul |
Pull changes from public repository and tweak the Foundry SDK to accommodate those changes
It looks like the documentation does not describe the scenario when on startup the AWS connect call fails (because of network not being available for example).
I used a connect loop similar to the one mentioned in #13 however it looks like this will leak the handles that are supposed to be cleaned by iot_tls_destroy.
If add this call to
IoT_Error_t aws_iot_mqtt_connect(MQTTConnectParams *pParams) {
...
pahoRc = MQTTConnect(&c, &data);
if(MQTT_NETWORK_ALREADY_CONNECTED_ERROR == pahoRc) {
rc = NETWORK_ALREADY_CONNECTED;
} else if(SUCCESS != pahoRc) {
// this is a hack, but otherwise we'll leak those buffers on every connection attempt
iot_tls_destroy(NULL);
rc = CONNECTION_ERROR;
}
return rc;
...
, then the memory leak goes away (i.e. memory usage no longer increases, and valgrind also seems to be reasonably happy).
The text was updated successfully, but these errors were encountered: