src/share/bin/parse_manifest.c

Print this page




  74         if (size_out) {
  75             *size_out = (int)entry->csize;
  76         }
  77         return (in);
  78     } else if (entry->how == DEFLATED) {
  79         zs.zalloc = (alloc_func)Z_NULL;
  80         zs.zfree = (free_func)Z_NULL;
  81         zs.opaque = (voidpf)Z_NULL;
  82         zs.next_in = (Byte*)in;
  83         zs.avail_in = (uInt)entry->csize;
  84         if (inflateInit2(&zs, -MAX_WBITS) < 0) {
  85             free(in);
  86             return (NULL);
  87         }
  88         if ((out = malloc(entry->isize + 1)) == NULL) {
  89             free(in);
  90             return (NULL);
  91         }
  92         zs.next_out = (Byte*)out;
  93         zs.avail_out = (uInt)entry->isize;
  94         if (inflate(&zs, Z_PARTIAL_FLUSH) < 0) {
  95             free(in);
  96             free(out);
  97             return (NULL);
  98         }
  99         *(char *)((size_t)out + entry->isize) = '\0';
 100         free(in);
 101         if (inflateEnd(&zs) < 0) {
 102             free(out);
 103             return (NULL);
 104         }
 105         if (size_out) {
 106             *size_out = (int)entry->isize;
 107         }
 108         return (out);
 109     } else
 110         return (NULL);
 111 }
 112 
 113 /*
 114  * A very little used routine to handle the case that zip file has




  74         if (size_out) {
  75             *size_out = (int)entry->csize;
  76         }
  77         return (in);
  78     } else if (entry->how == DEFLATED) {
  79         zs.zalloc = (alloc_func)Z_NULL;
  80         zs.zfree = (free_func)Z_NULL;
  81         zs.opaque = (voidpf)Z_NULL;
  82         zs.next_in = (Byte*)in;
  83         zs.avail_in = (uInt)entry->csize;
  84         if (inflateInit2(&zs, -MAX_WBITS) < 0) {
  85             free(in);
  86             return (NULL);
  87         }
  88         if ((out = malloc(entry->isize + 1)) == NULL) {
  89             free(in);
  90             return (NULL);
  91         }
  92         zs.next_out = (Byte*)out;
  93         zs.avail_out = (uInt)entry->isize;
  94         if (inflate(&zs, Z_FINISH) != Z_STREAM_END) {
  95             free(in);
  96             free(out);
  97             return (NULL);
  98         }
  99         *(char *)((size_t)out + entry->isize) = '\0';
 100         free(in);
 101         if (inflateEnd(&zs) < 0) {
 102             free(out);
 103             return (NULL);
 104         }
 105         if (size_out) {
 106             *size_out = (int)entry->isize;
 107         }
 108         return (out);
 109     } else
 110         return (NULL);
 111 }
 112 
 113 /*
 114  * A very little used routine to handle the case that zip file has