Plug more leaks
authorBehdad Esfahbod <behdad@behdad.org>
Wed, 11 May 2011 18:30:56 +0000 (14:30 -0400)
committerBehdad Esfahbod <behdad@behdad.org>
Wed, 11 May 2011 18:30:56 +0000 (14:30 -0400)
All good now.

src/hb-blob.cc
src/hb-open-type-private.hh

index cdb7496..17ff339 100644 (file)
@@ -126,7 +126,7 @@ hb_blob_create_sub_blob (hb_blob_t    *parent,
 {
   hb_blob_t *blob;
 
-  if (!length || offset >= parent->length || !(blob = hb_object_create<hb_blob_t> ()))
+  if (!length || offset >= parent->length)
     return &_hb_blob_nil;
 
   hb_blob_make_immutable (parent);
index e16eddd..4aa47ec 100644 (file)
@@ -191,8 +191,8 @@ struct hb_sanitize_context_t
 
   inline void setup (void)
   {
-    this->start = hb_blob_get_data (blob, NULL);
-    this->end = this->start + hb_blob_get_length (blob);
+    this->start = hb_blob_get_data (this->blob, NULL);
+    this->end = this->start + hb_blob_get_length (this->blob);
     this->edit_count = 0;
     this->debug_depth = 0;
 
@@ -321,10 +321,8 @@ struct Sanitizer
          sane = false;
        }
       }
-      c->finish ();
     } else {
       unsigned int edit_count = c->edit_count;
-      c->finish ();
       if (edit_count && !c->writable) {
         c->start = hb_blob_get_data_writable (blob, NULL);
        c->end = c->start + hb_blob_get_length (blob);
@@ -339,6 +337,8 @@ struct Sanitizer
       }
     }
 
+    c->finish ();
+
     (void) (HB_DEBUG_SANITIZE &&
       fprintf (stderr, "Sanitizer %p %s %s\n", blob, sane ? "passed" : "FAILED", HB_FUNC));
     if (sane)