]> git.proxmox.com Git - mirror_edk2.git/blobdiff - StdLib/BsdSocketLib/res_mkupdate.c
MdePkg: Add BluetoothAttribute.h and BluetoothLeConfig.h
[mirror_edk2.git] / StdLib / BsdSocketLib / res_mkupdate.c
index b27c2e460b886a20241fcc957c8d46b1cb655e9b..db8540ab4b85ce307889b02912733e5a46a9940e 100644 (file)
@@ -1,3 +1,13 @@
+/** @file\r
+  Copyright (c) 1999 - 2014, Intel Corporation. All rights reserved.<BR>\r
+  This program and the accompanying materials are licensed and made available\r
+  under the terms and conditions of the BSD License which accompanies this\r
+  distribution.  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php.\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+**/\r
 /*\r
  * Copyright (c) 1996 by Internet Software Consortium.\r
  *\r
  * <viraj_bais@ccm.fm.intel.com>\r
  */\r
 \r
-#if !defined(lint) && !defined(SABER)\r
-static char rcsid[] = "$Id: res_mkupdate.c,v 1.1.1.1 2003/11/19 01:51:38 kyu3 Exp $";\r
-#endif /* not lint */\r
-\r
 #include <sys/types.h>\r
 #include <sys/param.h>\r
 \r
@@ -104,7 +110,7 @@ int
 res_mkupdate(ns_updrec *rrecp_in, u_char *buf, int buflen) {\r
     ns_updrec *rrecp_start = rrecp_in;\r
     HEADER *hp;\r
-    u_char *cp, *sp1, *sp2, *startp, *endp;\r
+    u_char *cp, *sp2, *startp, *endp;\r
     int n, i, soanum, multiline;\r
     ns_updrec *rrecp;\r
     struct in_addr ina;\r
@@ -129,7 +135,6 @@ res_mkupdate(ns_updrec *rrecp_in, u_char *buf, int buflen) {
     hp->id = htons(++_res.id);\r
     hp->opcode = ns_o_update;\r
     hp->rcode = NOERROR;\r
-    sp1 = buf + 2*INT16SZ;  /* save pointer to zocount */\r
     cp = buf + HFIXEDSZ;\r
     buflen -= HFIXEDSZ;\r
     dpp = dnptrs;\r
@@ -433,8 +438,10 @@ res_mkupdrec(int section, const char *dname,
          u_int class, u_int type, u_long ttl) {\r
     ns_updrec *rrecp = (ns_updrec *)calloc(1, sizeof(ns_updrec));\r
 \r
-    if (!rrecp || !(rrecp->r_dname = strdup(dname)))\r
+    if (!rrecp || !(rrecp->r_dname = strdup(dname))) {\r
+        free(rrecp);\r
         return (NULL);\r
+    }\r
     rrecp->r_class = (u_int16_t)class;\r
     rrecp->r_type = (u_int16_t)type;\r
     rrecp->r_ttl = (u_int32_t)ttl;\r