Subject: | malloc error when running Net::SMTP::SSL on Mac OS X 10.8.2/Perl 5.12.4 |
Date: | Wed, 20 Feb 2013 07:02:40 -0800 |
To: | "bug-Net-SMTP-SSL [...] rt.cpan.org" <bug-Net-SMTP-SSL [...] rt.cpan.org> |
From: | Ian Crew <icrew [...] berkeley.edu> |
I'm running Mac OS X 10.8.2 with Perl 5.12.4 (the version that comes with it).
I installed Net::SMTP::SSL via CPAN ('sudo cpan', then 'install Net::SMTP::SSL')
Whenever I try to use the perl module, I get an error that looks like:
perl(41125) malloc: *** error for object 0x7fff8929d50d: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Abort trap: 6
I've tried to simplify this down as much as possible to narrow down the error. In the following code, it will crash when it tries to run the $smtp->auth line (right after the "About to crash" line).
--------------------------------------------------------------------------------
#!/usr/bin/perl
use Net::SMTP::SSL;
$mailhost = 'foo.bar.com';
$sender = 'baz@foo.bar.com';
$sender_acct = 'baz';
$sender_name = 'Foo Bar';
$sender_password = 'password';
$subject = 'Auto notice';
$userEmail = 'user@foo.bar.com';
$thisMessage = "Hello from Foo Bar\n";
our $smtp = new Net::SMTP::SSL(
$mailhost,
Port => 465,
#Debug => 1,
#Hello => 'foo.bar.com',
#Timeout => 10
) or die "Could not set up SMTP $!\n$smtp->message";
print "About to crash\n";
# -- Authorize ourselves with the SMTP server --
$smtp->auth($sender_acct, $sender_password);
# -- Enter sender mail address. --
$smtp->mail($sender);
# -- Enter recipient mails address. --
@success = $smtp->recipient($userEmail, { SkipBad => 1 });
$smtp->data();
# -- This part creates the SMTP headers you see. --
$smtp->datasend("To: <$userEmail> \n");
$smtp->datasend("From: $sender_name <$sender> \n");
$smtp->datasend("Subject: $subject");
# -- line break to separate headers from message body. --
$smtp->datasend("\n");
$smtp->datasend($thisMessage);
$smtp->datasend("\n");
$smtp->dataend();
$smtp->quit();
--------------------------------------------------------------------------------
I'm confident it's not an error in my script, as it works fine when I run it on another platform (Perl 5.8.8 on RHEL5).
Net::SMTP::SSL installed without errors.
There has been a little discussion of this at http://stackoverflow.com/questions/14974161/perl-netsmtpssl-error-on-mac-os-malloc-error-for-object-0x7fff8929d50, if that's helpful.
Thanks,
Ian