I was thinking that the OP wanted a test failure
Where did you glean that idea from? The OP has obviously reduced a larger piece of code to a simple test case to demonstrate a really bizarre issue. Assuming it runs as advertised, the code does just what the OP wants. The question is: "Why?".
I tried reversing the sense of the test to get around the freed value warning.
What freed value warning? The OP used a die statement to show the puzzling result the code produces, but that is not an error or warning, just one of the ways the result could have been shown.
How would you handle it?
I looked at the code. Determined I hadn't the SNMP module installed and on Windows that looked like more work than I could be bothered with to install. I couldn't verify the result so I left the question for someone else to answer. dave_the_m's answer seems most likely correct, although I'd have pointed the finger at the more general "corrupting memory" answer.
If you are unsure of your understanding of a question you should either ask a follow up question (if the OP's question seems unclear) or don't answer if it is an area you are unfamiliar with and can't be bothered researching.
True laziness is hard work
|