========================================================================= */
| 1291 | |
| 1292 | /* ========================================================================= */ |
| 1293 | int ZEXPORT deflateEnd(z_streamp strm) { |
| 1294 | int status; |
| 1295 | |
| 1296 | if (deflateStateCheck(strm)) return Z_STREAM_ERROR; |
| 1297 | |
| 1298 | status = strm->state->status; |
| 1299 | |
| 1300 | /* Deallocate in reverse order of allocations: */ |
| 1301 | TRY_FREE(strm, strm->state->pending_buf); |
| 1302 | TRY_FREE(strm, strm->state->head); |
| 1303 | TRY_FREE(strm, strm->state->prev); |
| 1304 | TRY_FREE(strm, strm->state->window); |
| 1305 | |
| 1306 | ZFREE(strm, strm->state); |
| 1307 | strm->state = Z_NULL; |
| 1308 | |
| 1309 | return status == BUSY_STATE ? Z_DATA_ERROR : Z_OK; |
| 1310 | } |
| 1311 | |
| 1312 | /* ========================================================================= |
| 1313 | * Copy the source state to the destination state. |
no test coverage detected