Skip to content

Commit

Permalink
Merge pull request #1049 from RSilicon/ok
Browse files Browse the repository at this point in the history
Use goto for clearer handling of errors
  • Loading branch information
zdohnal authored Sep 17, 2024
2 parents bb38f96 + ab74ed8 commit faf144f
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions scheduler/colorman.c
Original file line number Diff line number Diff line change
Expand Up @@ -512,9 +512,7 @@ apple_register_profiles(
{
cupsdLogMessage(CUPSD_LOG_ERROR,
"Unable to allocate memory for color profile.");
CFRelease(profiles);
ppdClose(ppd);
return;
goto end;
}

apple_init_profile(ppd, languages, profile, profile_id, attr->spec,
Expand Down Expand Up @@ -624,9 +622,7 @@ apple_register_profiles(
{
cupsdLogMessage(CUPSD_LOG_ERROR,
"Unable to allocate memory for color profile.");
CFRelease(profiles);
ppdClose(ppd);
return;
goto end;
}

apple_init_profile(ppd, NULL, profile, profile_id, cm_choice->choice,
Expand Down Expand Up @@ -668,9 +664,7 @@ apple_register_profiles(
{
cupsdLogMessage(CUPSD_LOG_ERROR,
"Unable to allocate memory for color profile.");
CFRelease(profiles);
ppdClose(ppd);
return;
goto end;
}

profile_id = _ppdHashName("Gray..");
Expand Down Expand Up @@ -698,9 +692,7 @@ apple_register_profiles(
{
cupsdLogMessage(CUPSD_LOG_ERROR,
"Unable to allocate memory for color profile.");
CFRelease(profiles);
ppdClose(ppd);
return;
goto end;
}

switch (ppd->colorspace)
Expand Down Expand Up @@ -844,7 +836,7 @@ apple_register_profiles(
/*
* Free any memory we used...
*/

end:
CFRelease(profiles);

ppdClose(ppd);
Expand Down

0 comments on commit faf144f

Please sign in to comment.