[Click] click-uninstall error

Beyers Cronje bcronje at cs.co.za
Tue Nov 30 09:18:31 EST 2004


Hi Bart,

Thanks for your response. I do not have any objects in the FlowInfo struct and the potential_supernodes map does not contain any pointers. Below FlowInfo and potential_supernodes declarations.

I cant see anything wrong with this, unless V of the hashmap should be a pointer ? 
Atleast if I know the problem is not in my element I can start troubleshooting the other elements used.

Kind regards

Beyers Cronje

*********************************
struct FlowInfo{
    IPFlowID _flow;
    bool _reverse : 1;
    bool _done : 1;
    bool _logged : 1;
    Flow_Type _type;
    int _used;
    uint8_t _pcount;

    FlowInfo() : _flow(), _reverse(false), _done(0), _logged(0), _type(OTHER), _used(0), _pcount(0) { }
    FlowInfo(IPFlowID flow) : _flow(flow), _reverse(false), _done(false), _logged(0), _type(OTHER),
		 _used(0), _pcount(0) { }
    FlowInfo(IPFlowID flow, Flow_Type type) : _flow(flow), _reverse(false), _done(false), _logged(0),
		 _type(type), _used(0), _pcount(0) { }
    bool reverse() const    { return _reverse; }
};
typedef HashMap<IPFlowID, FlowInfo *> Map;
typedef HashMap<in_addr, IPAddress> potential_supernodes
*********************************

-----Original Message-----
From: click-bounces at amsterdam.lcs.mit.edu
[mailto:click-bounces at amsterdam.lcs.mit.edu]On Behalf Of Bart Braem
Sent: Tuesday, November 30, 2004 9:54 AM
To: click at amsterdam.lcs.mit.edu
Subject: Re: [Click] click-uninstall error


> void IPStats::clean_map() {>                 FlowInfo *fi;>     for (Map::iterator iter = _map.begin(); iter; iter++)> {       //Clean Flow map>             fi = iter.value();>                         if (fi != 0)>         delete fi;>     };>                 potential_supernodes.clear();>                 for (Map::iterator iter = _to_clean_map.begin(); iter;> iter++) {       //Clean any entries left in timedout or reset> flows>                                 fi = iter.value();>                                 if (fi != 0)>                                                 delete fi;>                 };> };
Firstly: as far as I know deleting 0 is ok, so you don't need the if (fi != 0) condition.But then: where is the nullpointer dereferencing? I'd go for potential_supernodes.clear(), this code seems fine to me, if your maps don't contain any objects with your own destructors. In that case they might chain into some nullpointer dereference far, far way...
Hope this helps,Bart
_______________________________________________
click mailing list
click at amsterdam.lcs.mit.edu
https://amsterdam.lcs.mit.edu/mailman/listinfo/click
This is an email from CS Holdings. It is confidential to the 
ordinary user of the email address to which it is addressed 
and may contain copyright and/or legally privileged information.
No one else may read, print, store, copy, forward or act in 
reliance upon all or any part of it or its attachments. If you 
received this email in error please notify its sender.



More information about the click mailing list