S
Stuart Kendrick
hi folks,
i don't understand why Perl bombs with 'Use of freed value in
iteration' in my code below... i don't see where i'm modifying the
contents of %esx in my loop. can anyone see what i'm missing?
guru> cat test
#!/opt/local/bin/perl
use strict;
use warnings;
use SNMP;
my $obj = "sysDescr";
my $read = "public";
my ($sess, $val, $vb);
my %esx = ( "10.10.22.8" => "b2-esx",
"10.10.16.8" => "a1-esx",
"10.10.18.8" => "a2-esx",
"10.10.20.8" => "a3-esx",
);
for my $addr (keys %esx) {
print "Processing $addr\n";
$sess = new SNMP::Session ( Community => $read,
DestHost => $addr,
);
$vb = new SNMP::Varbind([$obj]);
$val = $sess->bulkwalk('0', '10000', $vb);
print "Finished $addr\n";
}
guru> ./test
Processing 10.10.18.8
Finished 10.10.18.8
Processing 10.10.22.8
Finished 10.10.22.8
Use of freed value in iteration at ./test line 24.
guru>
Notes:
-line 24 is the 'print "Finished $addr\n";' line.
-naturally, im my real code, i'm not performing snmpbulkwalks on
sysDescr ... but this snippet replicates the problem and produces much
simpler output.
-perl 5.8.5, net-snmp 5.0.9
--sk
stuart kendrick
fhcrc
i don't understand why Perl bombs with 'Use of freed value in
iteration' in my code below... i don't see where i'm modifying the
contents of %esx in my loop. can anyone see what i'm missing?
guru> cat test
#!/opt/local/bin/perl
use strict;
use warnings;
use SNMP;
my $obj = "sysDescr";
my $read = "public";
my ($sess, $val, $vb);
my %esx = ( "10.10.22.8" => "b2-esx",
"10.10.16.8" => "a1-esx",
"10.10.18.8" => "a2-esx",
"10.10.20.8" => "a3-esx",
);
for my $addr (keys %esx) {
print "Processing $addr\n";
$sess = new SNMP::Session ( Community => $read,
DestHost => $addr,
);
$vb = new SNMP::Varbind([$obj]);
$val = $sess->bulkwalk('0', '10000', $vb);
print "Finished $addr\n";
}
guru> ./test
Processing 10.10.18.8
Finished 10.10.18.8
Processing 10.10.22.8
Finished 10.10.22.8
Use of freed value in iteration at ./test line 24.
guru>
Notes:
-line 24 is the 'print "Finished $addr\n";' line.
-naturally, im my real code, i'm not performing snmpbulkwalks on
sysDescr ... but this snippet replicates the problem and produces much
simpler output.
-perl 5.8.5, net-snmp 5.0.9
--sk
stuart kendrick
fhcrc