version 1.3, 2005/07/25 12:05:43 |
version 1.4, 2005/12/10 20:27:45 |
|
|
return (NULL); |
return (NULL); |
} |
} |
|
|
ctx = (CVSZCTX *)malloc(sizeof(*ctx)); |
ctx = (CVSZCTX *)xmalloc(sizeof(*ctx)); |
if (ctx == NULL) { |
if (ctx == NULL) { |
cvs_log(LP_ERRNO, "failed to allocate zlib context"); |
cvs_log(LP_ERRNO, "failed to allocate zlib context"); |
return (NULL); |
return (NULL); |
|
|
if ((inflateInit(&(ctx->z_instrm)) != Z_OK) || |
if ((inflateInit(&(ctx->z_instrm)) != Z_OK) || |
(deflateInit(&(ctx->z_destrm), level) != Z_OK)) { |
(deflateInit(&(ctx->z_destrm), level) != Z_OK)) { |
cvs_log(LP_ERR, "failed to initialize zlib streams"); |
cvs_log(LP_ERR, "failed to initialize zlib streams"); |
free(ctx); |
xfree(ctx); |
return (NULL); |
return (NULL); |
} |
} |
|
|
|
|
if (ctx != NULL) { |
if (ctx != NULL) { |
(void)inflateEnd(&(ctx->z_instrm)); |
(void)inflateEnd(&(ctx->z_instrm)); |
(void)deflateEnd(&(ctx->z_destrm)); |
(void)deflateEnd(&(ctx->z_destrm)); |
free(ctx); |
xfree(ctx); |
} |
} |
} |
} |
|
|