During the apartheid era, there were one or two cases where journalists or activists attempted to raise a "public interest" type defence to criminal charges instituted under prevailing security and information legislation. They did this by attempting to extend the criminal law notion of "private defence" (where a person's allegedly criminal conduct is deemed lawful because they were acting in defence of themselves or a third party) to instances where information was accessed or released in the public interest.
These cases were ultimately determined on other grounds, but the defences were certainly not dismissed outright - in one case the then Chief Justice, Corbett CJ, held as follows: "The defence had sufficient substance to merit ... serious consideration ... "
Notwithstanding the very oppressive information and secrecy regime under the apartheid government, the courts still occasionally emphasised the importance of media freedom. In one case in which a journalist was detained under the Public Security Act for refusing to disclose his source, the court held in his favour and stated the following:
"The right of members of the public to criticise, even in scathing terms, the action of a government ... is one of the cornerstones of democracy."
Of course, these sorts of rulings were the exception.