Ok, I was getting some warnings about converting string to char* which is why i went this
route. I'll research it a bit more
----- Original Message -----
On Thu, Jun 16, 2011 at 10:07 PM, Adam Stokes
<astokes(a)fedoraproject.org> wrote:
> +class MhHsaSuite : public CxxTest::TestSuite
> +{
> + public:
> + std::stringstream infomsg;
> +
> + void testSrvLookup(void)
> + {
> + int ret;
> + char target[MAX_NAME_LEN];
> + char *host = strdup("_matahari._tcp.matahariproject.org");
> + const char *subject = NULL;
> +
> + if ((ret = srv_lookup(host, target)) == 0) {
> + infomsg << "SRV record: " << target;
> + TS_TRACE(infomsg.str());
> + subject = strdup(target);
> + TS_ASSERT((mh_test_is_match("^qpid.*matahariproject\\.org$",
> subject)) >= 0);
> + }
> + }
> +};
> +
You've got some memory leaks here due to the use of strdup() without a
corresponding free(). I'm not sure strdup() is necessary at all,
though.
--
Russell Bryant
_______________________________________________
Matahari mailing list
Matahari(a)lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/matahari
--
__ __
.-----.| |_.-----.| |--.-----.-----.
|__ --|| _| _ || <| -__|__ --|
|_____||____|_____||__|__|_____|_____|
.----------------------------------.
( ajs(a)redhat.com || 919.754.4187 )
`----------------------------------'