Changeset a0d97f83 in mainline for uspace/srv/net/dnsrsrv/query.c


Ignore:
Timestamp:
2013-05-03T08:44:14Z (12 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ef904895
Parents:
48171fc4
Message:

Fix message allocation/deallocation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/net/dnsrsrv/query.c

    r48171fc4 ra0d97f83  
    5252        dns_message_t *msg;
    5353        dns_message_t *amsg;
    54         dns_question_t question;
     54        dns_question_t *question;
    5555        dns_host_info_t *info;
    5656        int rc;
    5757
    58         question.qname = (char *)name;
    59         question.qtype = DTYPE_A;
    60         question.qclass = DC_IN;
     58        question = calloc(1, sizeof(dns_question_t));
     59        if (question == NULL)
     60                return ENOMEM;
    6161
    62         msg = calloc(1, sizeof(dns_message_t));
     62        question->qname = (char *)name;
     63        question->qtype = DTYPE_A;
     64        question->qclass = DC_IN;
     65
     66        msg = dns_message_new();
    6367        if (msg == NULL)
    6468                return ENOMEM;
    6569
    66         list_initialize(&msg->question);
    67         list_append(&question.msg, &msg->question);
     70        list_append(&question->msg, &msg->question);
    6871
    6972        msg->id = msg_id++;
     
    100103                            info->addr.ipv4);
    101104
     105                        dns_message_destroy(msg);
    102106                        dns_message_destroy(amsg);
    103107                        *rinfo = info;
Note: See TracChangeset for help on using the changeset viewer.