Move allocation afer initial checks, fixing memory leak.
authorOwen Taylor <otaylor@redhat.com>
Sat, 26 Jul 2003 15:02:13 +0000 (15:02 +0000)
committerOwen Taylor <otaylor@src.gnome.org>
Sat, 26 Jul 2003 15:02:13 +0000 (15:02 +0000)
Sat Jul 26 10:52:20 2003  Owen Taylor  <otaylor@redhat.com>

        * pango/opentype/ftxgpos.c (Lookup_ContextPos2):
        * pango/opentype/ftxgsub.c (Lookup_ContextSubst2): Move
        allocation afer initial checks, fixing memory leak.

        * pango/opentype/ftxgsub.c (Lookup_ChainContextSubst2):
        Fix some more error return memory leaks that weren't
        fixed in the Qt changes.

src/ftxgpos.c
src/ftxgsub.c

index 10267e0..7a17e1c 100644 (file)
 
     gdef = gpos->gdef;
 
-    if ( ALLOC_ARRAY( classes, cpf2->MaxContextLength, FT_UShort ) )
-      return error;
-
     if ( CHECK_Property( gdef, in->string[in->pos], flags, &property ) )
       return error;
 
 
     error = Coverage_Index( &cpf2->Coverage, in->string[in->pos], &index );
     if ( error )
-      goto End;
+      return error;
+
+    if ( ALLOC_ARRAY( classes, cpf2->MaxContextLength, FT_UShort ) )
+      return error;
 
     error = Get_Class( &cpf2->ClassDef, in->string[in->pos],
                        &classes[0], NULL );
index c2a59ba..aedc551 100644 (file)
 
     gdef = gsub->gdef;
 
-    if ( ALLOC_ARRAY( classes, csf2->MaxContextLength, FT_UShort ) )
-      return error;
-
     if ( CHECK_Property( gdef, in->string[in->pos], flags, &property ) )
       return error;
 
 
     error = Coverage_Index( &csf2->Coverage, in->string[in->pos], &index );
     if ( error )
-      goto End;
+      return error;
+
+    if ( ALLOC_ARRAY( classes, csf2->MaxContextLength, FT_UShort ) )
+      return error;
 
     error = Get_Class( &csf2->ClassDef, in->string[in->pos],
                        &classes[0], NULL );
           while ( CHECK_Property( gdef, s_in[j], flags, &property ) )
           {
             if ( error && error != TTO_Err_Not_Covered )
-              return error;
+              goto End1;
 
             if ( j > curr_pos )
               j--;
         while ( CHECK_Property( gdef, s_in[j], flags, &property ) )
         {
           if ( error && error != TTO_Err_Not_Covered )
-            return error;
+            goto End1;
 
           if ( curr_pos + j < in->length )
             j++;