Merge "bootable/recovery: cleanup compiler warnings (unused value)" am: ef3bea15b8 am: 80cd188162
am: bd8f34190c

Change-Id: I8d5eb7a5abff461df9620bdef598797be0033f87
diff --git a/applypatch/imgdiff.cpp b/applypatch/imgdiff.cpp
index 4dc4810..528daf1 100644
--- a/applypatch/imgdiff.cpp
+++ b/applypatch/imgdiff.cpp
@@ -321,6 +321,10 @@
       // -15 means we are decoding a 'raw' deflate stream; zlib will
       // not expect zlib headers.
       int ret = inflateInit2(&strm, -15);
+      if (ret < 0) {
+        printf("failed to initialize inflate: %d\n", ret);
+        return NULL;
+      }
 
       strm.avail_out = curr->len;
       strm.next_out = curr->data;
@@ -446,6 +450,10 @@
       // -15 means we are decoding a 'raw' deflate stream; zlib will
       // not expect zlib headers.
       int ret = inflateInit2(&strm, -15);
+      if (ret < 0) {
+        printf("failed to initialize inflate: %d\n", ret);
+        return NULL;
+      }
 
       do {
         strm.avail_out = allocated - curr->len;
@@ -553,10 +561,18 @@
   int ret;
   ret = deflateInit2(&strm, chunk->level, chunk->method, chunk->windowBits,
                      chunk->memLevel, chunk->strategy);
+  if (ret < 0) {
+    printf("failed to initialize deflate: %d\n", ret);
+    return -1;
+  }
   do {
     strm.avail_out = BUFFER_SIZE;
     strm.next_out = out;
     ret = deflate(&strm, Z_FINISH);
+    if (ret < 0) {
+      printf("failed to deflate: %d\n", ret);
+      return -1;
+    }
     size_t have = BUFFER_SIZE - strm.avail_out;
 
     if (memcmp(out, chunk->deflate_data+p, have) != 0) {