Include stdlib.h everywhere we call (m|c)alloc.
[libradsec.git] / lib / packet.c
index ce68bea..bfa82df 100644 (file)
@@ -1,10 +1,11 @@
-/* Copyright 2010, 2011 NORDUnet A/S. All rights reserved.
-   See the file COPYING for licensing information.  */
+/* Copyright 2010-2013 NORDUnet A/S. All rights reserved.
+   See LICENSE for licensing information.  */
 
 #if defined HAVE_CONFIG_H
 #include <config.h>
 #endif
 
+#include <stdlib.h>
 #include <assert.h>
 #include <radius/client.h>
 #include <event2/bufferevent.h>
@@ -137,16 +138,6 @@ rs_packet_create (struct rs_connection *conn, struct rs_packet **pkt_out)
   if (rpkt == NULL)
     return rs_err_conn_push (conn, RSE_NOMEM, __func__);
 
-  /*
-   * This doesn't make sense; the packet identifier is constant for
-   * an entire conversation. A separate API should be provided to
-   * allow the application to set the packet ID, or a conversation
-   * object should group related packets together.
-   */
-#if 0
-  rpkt->id = conn->nextid++
-#endif
-
   err = nr_packet_init (rpkt, NULL, NULL,
                        PW_ACCESS_REQUEST,
                        rpkt + 1, RS_MAX_PACKET_LEN);
@@ -210,7 +201,7 @@ rs_packet_destroy (struct rs_packet *pkt)
 }
 
 int
-rs_packet_append_avp (struct rs_packet *pkt, 
+rs_packet_append_avp (struct rs_packet *pkt,
                       unsigned int attr, unsigned int vendor,
                       const void *data, size_t data_len)
 {
@@ -221,7 +212,7 @@ rs_packet_append_avp (struct rs_packet *pkt,
 
   da = nr_dict_attr_byvalue (attr, vendor);
   if (da == NULL)
-    return RSE_ATTR_TYPE_UNKNOWN;
+    return rs_err_conn_push (pkt->conn, RSE_ATTR_TYPE_UNKNOWN, __func__);
 
   err = nr_packet_attr_append (pkt->rpkt, NULL, da, data, data_len);
   if (err < 0)