ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid-8/src/conf_parser.y
(Generate patch)

Comparing ircd-hybrid-7.2/src/ircd_parser.y (file contents):
Revision 95 by db, Sat Oct 8 16:26:37 2005 UTC vs.
Revision 102 by michael, Mon Oct 10 12:17:19 2005 UTC

# Line 3570 | Line 3570 | gline_entry: GLINES
3570    if (ypass == 2)
3571    {
3572      yy_conf = make_conf_item(GDENY_TYPE);
3573 <    yy_aconf = (struct AccessItem *)map_to_conf(yy_conf);
3574 <    yy_aconf->flags = 0;
3573 >    yy_aconf = map_to_conf(yy_conf);
3574    }
3575   } '{' gline_items '}' ';'
3576   {
# Line 3581 | Line 3580 | gline_entry: GLINES
3580       * since we re-allocate yy_conf/yy_aconf after the end of action=, at the
3581       * end we will have one extra, so we should free it.
3582       */
3583 <    if (yy_conf->name == NULL && gdeny_items.length)
3583 >    if (yy_conf->name == NULL || yy_aconf->user == NULL)
3584      {
3585 <      dlinkDelete(gdeny_items.tail, &gdeny_items);
3587 <      MyFree(yy_conf);
3585 >      delete_conf_item(yy_conf);
3586        yy_conf = NULL;
3587        yy_aconf = NULL;
3588      }
# Line 3632 | Line 3630 | gline_user: USER '=' QSTRING ';'
3630   {
3631    if (ypass == 2)
3632    {
3633 <    struct CollectItem *yy_tmp;
3633 >    struct CollectItem *yy_tmp = NULL;
3634  
3635      if (yy_aconf->user == NULL)
3636      {
# Line 3640 | Line 3638 | gline_user: USER '=' QSTRING ';'
3638      }
3639      else
3640      {
3641 <      yy_tmp = (struct CollectItem *)MyMalloc(sizeof(struct CollectItem));
3641 >      yy_tmp = MyMalloc(sizeof(struct CollectItem));
3642        split_nuh(yylval.string, NULL, &yy_tmp->user, &yy_tmp->host);
3643        dlinkAdd(yy_tmp, &yy_tmp->node, &col_conf_list);
3644      }
# Line 3664 | Line 3662 | gline_action: ACTION
3662   {
3663    if (ypass == 2)
3664    {
3665 <    struct CollectItem *yy_tmp;
3665 >    struct CollectItem *yy_tmp = NULL;
3666      dlink_node *ptr, *next_ptr;
3667  
3668      DLINK_FOREACH_SAFE(ptr, next_ptr, col_conf_list.head)
# Line 3674 | Line 3672 | gline_action: ACTION
3672  
3673        yy_tmp = ptr->data;
3674        new_conf = make_conf_item(GDENY_TYPE);
3675 <      new_aconf = (struct AccessItem *)map_to_conf(new_conf);
3675 >      new_aconf = map_to_conf(new_conf);
3676  
3677        new_aconf->flags = yy_aconf->flags;
3678  
# Line 3693 | Line 3691 | gline_action: ACTION
3691  
3692        dlinkDelete(&yy_tmp->node, &col_conf_list);
3693      }
3694 +
3695 +    /*
3696 +     * In case someone has fed us with more than one action= after user/name
3697 +     * which would leak memory  -Michael
3698 +     */
3699 +    if (yy_conf->name == NULL || yy_aconf->user == NULL)
3700 +      delete_conf_item(yy_conf);
3701 +
3702 +    yy_conf = make_conf_item(GDENY_TYPE);
3703 +    yy_aconf = map_to_conf(yy_conf);
3704    }
3705   };
3706  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines