========================================================================= */
| 1256 | |
| 1257 | /* ========================================================================= */ |
| 1258 | int ZEXPORT deflateEnd(z_streamp strm) { |
| 1259 | int status; |
| 1260 | |
| 1261 | if (deflateStateCheck(strm)) return Z_STREAM_ERROR; |
| 1262 | |
| 1263 | status = strm->state->status; |
| 1264 | |
| 1265 | /* Deallocate in reverse order of allocations: */ |
| 1266 | TRY_FREE(strm, strm->state->pending_buf); |
| 1267 | TRY_FREE(strm, strm->state->head); |
| 1268 | TRY_FREE(strm, strm->state->prev); |
| 1269 | TRY_FREE(strm, strm->state->window); |
| 1270 | |
| 1271 | ZFREE(strm, strm->state); |
| 1272 | strm->state = Z_NULL; |
| 1273 | |
| 1274 | return status == BUSY_STATE ? Z_DATA_ERROR : Z_OK; |
| 1275 | } |
| 1276 | |
| 1277 | /* ========================================================================= |
| 1278 | * Copy the source state to the destination state. |
no test coverage detected