Azure / azure-sphere-samples

Samples for Azure Sphere
Other
223 stars 200 forks source link

Update get_device_id.c #235

Closed mikehall-ms closed 2 years ago

mikehall-ms commented 2 years ago

free the deviceCert once a device Id has been retrieved.

Omakas commented 2 years ago

Since the free is done at cleanup, than the deviceCert needs to be defined at the top of the function instead of where it is used. Something like below.

static int GetDeviceID(char* deviceId, size_t deviceIdLength)
{
    int result = -1;
    bool wolfSslInitialized = false;
    WOLFSSL_X509* deviceCert = NULL;
........