]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Use goto for clearer handling of errors 1049/head
authorRose <gfunni234@gmail.com>
Sat, 14 Sep 2024 18:47:43 +0000 (14:47 -0400)
committerRose <gfunni234@gmail.com>
Sat, 14 Sep 2024 19:30:45 +0000 (15:30 -0400)
Handle memory by jumping to the end where the profile is released

scheduler/colorman.c

index 27cd2982f1ec959c1184adb7a6a6394a5830c986..5784c1c75bd0eb4e01ba72ad52d24b3961d691c5 100644 (file)
@@ -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,
@@ -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,
@@ -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..");
@@ -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)
@@ -844,7 +836,7 @@ apple_register_profiles(
  /*
   * Free any memory we used...
   */
-
+end:
   CFRelease(profiles);
 
   ppdClose(ppd);