Use of freed value in iteration

Discussion in 'Perl Misc' started by Stuart Kendrick, Aug 5, 2004.

  1. 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
    Stuart Kendrick, Aug 5, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. dg
    Replies:
    0
    Views:
    322
  2. jimjim
    Replies:
    28
    Views:
    861
    Michael Wojcik
    Apr 14, 2004
  3. David Scarlett

    Just how delicate are freed pointers?

    David Scarlett, May 16, 2004, in forum: C Programming
    Replies:
    73
    Views:
    1,259
    Dan Pop
    May 21, 2004
  4. Rudi
    Replies:
    5
    Views:
    4,957
  5. A. Farber
    Replies:
    2
    Views:
    120
    Xho Jingleheimerschmidt
    Feb 28, 2010
Loading...

Share This Page