No sheriff or other officer shall be liable to a civil action for obeying any writ of habeas corpus or order of discharge made thereon.
R.L. 1910, § 4898.