One of the things I like about the HP books is how JKR portrays the good characters as being blinded by their own goodness, sometimes with the unintended consequence of making choices that produced more harm than good. Good intentions can and do go awry, mistakes happen, good folks make bad judgments, and human failings get in the way, even to those who mean well.
For instance, take the case of Dumbledore, widely regarded as powerful, wise, and good. His choices had a profound impact in shaping Harry's life, from the decision to leave him with the Dursley's to mentoring Harry once he arrived at Hogwarts. At the time he made these decisions, he was convinced he was doing the right thing for the good of those involved. In OOTP, Dumbledore admitted that he chose not to divulge information to Harry because he believed it was in Harry's best interest not to be burdened by the weight of the prophecy just yet. Despite the animosity between the two, he ordered Snape to provide Harry with Occlumency lessons, overestimating Snape's willingness and ability to overcome his childhood grudges and resentments. He believed that keeping Sirius housebound in the home he hated was the best way to protect him from the Ministry, despite the fact that Sirius has spent a large part of his years locked up in Azkaban and therefore, was a psychological powder keg waiting to happen. Then there's his steadfast belief in Snape's loyalty and redemption, which, depending on how events will play out in Book 7, shows how his goodness may have blinded him into giving second chances to those who don't deserve it.
Another example is Sirius and his choice to switch with Peter. Gryffindor,well-liked by his peers and teachers, best-friends with James, openly opposed to his family's pureblood mania, member of the Order,he was unquestionably on the side of good. To be fair, it was Peter who betrayed his friends to Voldemort. Sirius made the mistake of placing his trust in the wrong person. Then there's the prank he played with Snape, where he overlooked the danger he put Snape in, convinced that he was right in giving Snape a scare. In another case, the Pensieve scene with James shows how both Gryffindors were so convinced in the righteousness of their actions, they failed to realize how damaging it was to the recepient of their joke. Being sorted into a house known for universally accepted values aligned with the good does not automatically make one a good person, but it does enable its members an easier way to gain the trust and respect of their peers, a situation more difficult for Slytherins. For Sirius and James, being Gryffindors and rejecting anything that has to do with the Dark Arts may have gotten over their heads and prevented them from truly seeing how their behavior and actions toward Snape at that time is a form of bullying. From their vantage point, Snape's greasy, unnattractive features, proficiency in Dark-Arts, and house affiliation were enough indications to convince them that their actions towards him were acceptable and justified. No question, in the prank and that scene, Sirus and James had no good intentions for Snape, I don't think they intended to inflict serious harm on him. However, they definitely underestimated the damage they caused.
What makes Voldemort so evil is that his actions are ultimately self-serving and harms others in the process. He is prepared to get what he wants at all costs. On the other hand, while Harry has no great aspirations for greatness and power over others, he is not unlike the other good characters in being blinded by their own goodness and sense of rightness, which leads them to make choices that sometimes prove detrimental. In OOTP, Harry hastily makes the decision to rescue Sirius without checking up on him at Grimmauld Place first. In HBP, he throws a deadly curse at Draco which could have been more serious had Snape not intervened. He may not have intended Draco to suffer a serious injury, given that he reacted in the heat of the moment with the first hex he could come up with at that time. Nevertheless, he still was responsible for causing harm to a fellow student.
Another character who wants to do good but sometimes comes up with mixed results include Molly, who loves her family dearly but risks alienating herself from them with her overprotectiveness and tendency to compare her sons to one another. However well-intentioned she is in wanting to keep them safe from harm, whether it maybe in the form of Voldemort, or the perceived threat of a woman like Fleur occupying a place in Bill's life, she realizes that her children are growing up and she cannot shield them from the realities of the war forever. Fortunately, she and Fleur were able to come to an understanding. Her family's relationship with Percy though is yet to be resolved.
What separates the good characters from the evil ones is that in the end, the good characters ultimately want to make the right choices for the sake of others, not for their personal gain. Good characters make choices based on what is right vs. what is easy. They make choices based on long-term benefits. Dumbledore must have thought that in the long-run, Harry is better off growing up with the Dursleys, not just because of Petunia's protection, but because it was better for Harry to grow up away from fame and the expectations of the wizarding world before he is able to handle it all. Dumbledore may have thought that the Occlumency lessons would enable Harry and Snape an opportunity to set aside their anger and work together. Keeping Sirius housebound was the only option since he was still a wanted man, although Grimmauld Place probably wasn't the best place to hide. Sirius knew of the risks in going to the Dept.of Mysteries, yet he went anyway because others were in danger. James may have disliked Snape, but he still went ahead and saved his life. After hexing Draco, Harry was horrified at what he had done, I don't think he anticipated the violence of the curse. Finally, Harry's attempt to rescue Sirius may have ended badly, but no one would argue that helping others when they're in danger would have been the right thing to do. Afterall, it is what we have come to expect from heroes.