fix run-away pointer (and potential SEGV) when adding duplicates in add_cert_dir. PR: 3261 Reported by: Marian Done (Imported from upstream's 83fe7b9c8321d5ffb6bfe67df85ed66ceb97102f)
Initial fork from f2d678e6e89b6508147086610e985d4e8416e867 (1.0.2 beta). (This change contains substantial changes from the original and effectively starts a new history.)