mirror of
https://github.com/eclipse/upm.git
synced 2025-03-24 01:10:22 +03:00
memory: Small changes to fix some memory leaks.
Four small leaks in *scam, sx1276, and ozw. Added calls to cleanup resources before throws. Signed-off-by: Noel Eck <noel.eck@intel.com>
This commit is contained in:
parent
87b10e33d0
commit
a57f1c9691
@ -468,6 +468,7 @@ bool GROVESCAM::storeImage(const char *fname)
|
|||||||
goto retry;
|
goto retry;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
fclose(file);
|
||||||
throw std::runtime_error(std::string(__FUNCTION__) +
|
throw std::runtime_error(std::string(__FUNCTION__) +
|
||||||
": cksum error, maximum retries exceeded");
|
": cksum error, maximum retries exceeded");
|
||||||
return false;
|
return false;
|
||||||
|
@ -54,6 +54,7 @@ OZW::OZW()
|
|||||||
|
|
||||||
if (pthread_mutex_init(&m_nodeLock, &mutexAttrib))
|
if (pthread_mutex_init(&m_nodeLock, &mutexAttrib))
|
||||||
{
|
{
|
||||||
|
pthread_mutexattr_destroy(&mutexAttrib);
|
||||||
throw std::runtime_error(std::string(__FUNCTION__) +
|
throw std::runtime_error(std::string(__FUNCTION__) +
|
||||||
": pthread_mutex_init(nodeLock) failed");
|
": pthread_mutex_init(nodeLock) failed");
|
||||||
}
|
}
|
||||||
|
@ -468,6 +468,7 @@ bool SCAM::storeImage(const char *fname)
|
|||||||
goto retry;
|
goto retry;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
fclose(file);
|
||||||
throw std::runtime_error(std::string(__FUNCTION__) +
|
throw std::runtime_error(std::string(__FUNCTION__) +
|
||||||
": cksum error, maximum retries exceeded");
|
": cksum error, maximum retries exceeded");
|
||||||
return false;
|
return false;
|
||||||
|
@ -151,6 +151,7 @@ SX1276::SX1276(uint8_t chipRev, int bus, int cs, int resetPin, int dio0,
|
|||||||
|
|
||||||
if (pthread_mutex_init(&m_intrLock, &mutexAttrib))
|
if (pthread_mutex_init(&m_intrLock, &mutexAttrib))
|
||||||
{
|
{
|
||||||
|
pthread_mutexattr_destroy(&mutexAttrib);
|
||||||
throw std::runtime_error(std::string(__FUNCTION__) +
|
throw std::runtime_error(std::string(__FUNCTION__) +
|
||||||
": pthread_mutex_init(intrLock) failed");
|
": pthread_mutex_init(intrLock) failed");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user