0

struct node_id{
    union {
         uint32_t numeric;
         struct my_string *string;
         struct my_bytestring *opaque;
    } identifier;
    enum my_identifiertype type;
    uint16_t index;
};

struct my_string{
    uint32_t len : 31;
    uint32_t free: 1;
    union {
      const char *cdata;
      char *data;
    } d;
};

get_nodeid(node_t node, struct nodeid *id){
   //some code
}

struct nodeid *id;
get_nodeid(node,id);
printf("%s", id->identifier.string->d.cdata );   // ------- Seg Fault comes here
nodeid_clear(&id);

|
  • 1