Pass size of buffer to avoid Z_BUF_ERROR when compressing ATA SMART blob
authorDavid Zeuthen <davidz@redhat.com>
Sat, 4 Jul 2009 22:31:24 +0000 (18:31 -0400)
committerDavid Zeuthen <davidz@redhat.com>
Sat, 4 Jul 2009 22:31:24 +0000 (18:31 -0400)
src/devkit-disks-ata-smart-db.c

index 9a0be35..2f247c0 100644 (file)
@@ -188,12 +188,13 @@ devkit_disks_ata_smart_db_add_entry (DevkitDisksAtaSmartDb *db,
         }
 
         /* compress the data */
-        compressed_blob = g_new0 (guchar, blob_size * 3 / 2 + 32);
+        compressed_blob = g_new0 (guchar, blob_size * 2 + 32);
+        compressed_blob_size = blob_size * 2 + 32;
         ret = compress2 (compressed_blob, &compressed_blob_size,
                          blob, blob_size,
                          1);
         if (ret != Z_OK) {
-                g_warning ("Error compressing blob: %d", ret);
+                g_warning ("Error compressing blob (size=%d): %d", (gint) blob_size, ret);
                 goto out;
         }