Skip to content

Commit

Permalink
Fix potential memory leak
Browse files Browse the repository at this point in the history
src/hotplug_macosx.c:211:3 Potential leak of an object stored into 'bundleArray'
  • Loading branch information
LudovicRousseau committed May 6, 2024
1 parent 061d59a commit a36fe79
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/hotplug_macosx.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ static HPDriverVector HPDriversGetFromDirectory(const char *driverBundlePath)
if (!blobValue)
{
Log1(PCSC_LOG_ERROR, "error getting vendor ID from bundle");
CFRelease(bundleArray);
return NULL;
}

Expand All @@ -209,6 +210,7 @@ static HPDriverVector HPDriversGetFromDirectory(const char *driverBundlePath)
if (!bundleVector)
{
Log1(PCSC_LOG_ERROR, "memory allocation failure");
CFRelease(bundleArray);
return NULL;
}

Expand All @@ -231,6 +233,7 @@ static HPDriverVector HPDriversGetFromDirectory(const char *driverBundlePath)
if (!blobValue)
{
Log1(PCSC_LOG_ERROR, "error getting vendor ID from bundle");
CFRelease(bundleArray);
return bundleVector;
}

Expand All @@ -250,6 +253,7 @@ static HPDriverVector HPDriversGetFromDirectory(const char *driverBundlePath)
if (!productArray)
{
Log1(PCSC_LOG_ERROR, "error getting product ID from bundle");
CFRelease(bundleArray);
return bundleVector;
}

Expand All @@ -259,6 +263,7 @@ static HPDriverVector HPDriversGetFromDirectory(const char *driverBundlePath)
if (!friendlyNameArray)
{
Log1(PCSC_LOG_ERROR, "error getting product ID from bundle");
CFRelease(bundleArray);
return bundleVector;
}

Expand All @@ -269,6 +274,7 @@ static HPDriverVector HPDriversGetFromDirectory(const char *driverBundlePath)
Log3(PCSC_LOG_ERROR,
"Malformed Info.plist: %ld vendors and %ld products",
reader_nb, CFArrayGetCount(productArray));
CFRelease(bundleArray);
return bundleVector;
}

Expand All @@ -277,6 +283,7 @@ static HPDriverVector HPDriversGetFromDirectory(const char *driverBundlePath)
Log3(PCSC_LOG_ERROR,
"Malformed Info.plist: %ld vendors and %ld friendlynames",
reader_nb, CFArrayGetCount(friendlyNameArray));
CFRelease(bundleArray);
return bundleVector;
}

Expand Down

0 comments on commit a36fe79

Please sign in to comment.