Advertisement
Guest User

Untitled

a guest
Apr 30th, 2014
648
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 3.67 KB | None | 0 0
  1. diff --git a/src/andna.c b/src/andna.c
  2. index 1c74f4e..3293a24 100644
  3. --- a/src/andna.c
  4. +++ b/src/andna.c
  5. @@ -1796,7 +1796,7 @@ andna_cache *get_single_andna_c(u_int hash[MAX_IP_INT],
  6.  {
  7.         PACKET pkt, rpkt;
  8.         struct single_acache_hdr req_hdr;
  9. -       andna_cache *andna_cache, *ret=0;
  10. +       andna_cache *ret=0;
  11.         u_int *new_hgnodes[1];
  12.         size_t pack_sz;
  13.         int err, counter;
  14. @@ -1845,9 +1845,9 @@ andna_cache *get_single_andna_c(u_int hash[MAX_IP_INT],
  15.         /* Unpack the waited reply */
  16.         pack_sz=rpkt.hdr.sz;
  17.         pack=rpkt.msg;
  18. -       ret=andna_cache=unpack_andna_cache(pack, pack_sz, &counter,
  19. +       ret=unpack_andna_cache(pack, pack_sz, &counter,
  20.                         ACACHE_PACK_PKT);
  21. -       if(!andna_cache && counter < 0) {
  22. +       if(!ret && counter < 0) {
  23.                 error("get_single_acache(): Malformed andna_cache.");
  24.                 ERROR_FINISH(ret, 0, finish);
  25.         }
  26. @@ -2126,7 +2126,7 @@ finish:
  27.  andna_cache *get_andna_cache(map_node *dst_rnode, int *counter)
  28.  {
  29.         PACKET pkt, rpkt;
  30. -       andna_cache *andna_cache, *ret=0;
  31. +       andna_cache *ret=0;
  32.         size_t pack_sz;
  33.         int err;
  34.         char *pack;
  35. @@ -2153,9 +2153,9 @@ andna_cache *get_andna_cache(map_node *dst_rnode, int *counter)
  36.  
  37.         pack_sz=rpkt.hdr.sz;
  38.         pack=rpkt.msg;
  39. -       ret=andna_cache=unpack_andna_cache(pack, pack_sz, counter,
  40. +       ret=unpack_andna_cache(pack, pack_sz, counter,
  41.                         ACACHE_PACK_PKT);
  42. -       if(!andna_cache && counter < 0)
  43. +       if(!ret && counter < 0)
  44.                 error("get_andna_cache(): Malformed or empty andna_cache. "
  45.                                 "Cannot load it");
  46.  
  47. diff --git a/src/andns_lib.c b/src/andns_lib.c
  48. index 78e9ff8..806e626 100644
  49. --- a/src/andns_lib.c
  50. +++ b/src/andns_lib.c
  51. @@ -104,7 +104,7 @@ int a_hdr_u(char *buf,andns_pkt *ap)
  52.         ap->id>>=1;
  53.          buf+=2;
  54.  
  55. -        memcpy(&c,buf,2);
  56. +        memcpy(&c,buf,sizeof(uint8_t));
  57.          ap->qr=(c>>7)&0x01;
  58.          ap->p=c&0x40?ANDNS_PROTO_UDP:ANDNS_PROTO_TCP;
  59.         ap->z=c&0x20;
  60. diff --git a/src/gmap.c b/src/gmap.c
  61. index ae0de3d..35df8a7 100644
  62. --- a/src/gmap.c
  63. +++ b/src/gmap.c
  64. @@ -1488,6 +1488,7 @@ map_gnode **load_extmap(char *file, quadro_group *quadg)
  65.         fclose(fd);
  66.         return ext_map;
  67.  error:
  68. +       fclose(fd);
  69.         error("Malformed ext_map file. Aborting load_extmap().");
  70.         return 0;
  71.  }
  72. diff --git a/src/inet.c b/src/inet.c
  73. index 6d8b0bd..8bfb702 100644
  74. --- a/src/inet.c
  75. +++ b/src/inet.c
  76. @@ -272,8 +272,8 @@ void unpack_inet_prefix(inet_prefix *ip, char *pack)
  77.   */
  78.  int inet_addr_match(const inet_prefix *a, const inet_prefix *b, int bits)
  79.  {
  80. -        uint32_t *a1 = a->data;
  81. -        uint32_t *a2 = b->data;
  82. +        const uint32_t *a1 = a->data;
  83. +        const uint32_t *a2 = b->data;
  84.          int words = bits >> 0x05;
  85.          
  86.          bits &= 0x1f;
  87. diff --git a/src/libiptc/libiptc.c b/src/libiptc/libiptc.c
  88. index 6a09d72..f4d2feb 100644
  89. --- a/src/libiptc/libiptc.c
  90. +++ b/src/libiptc/libiptc.c
  91. @@ -509,6 +509,7 @@ new_rule:
  92.                         t = (STRUCT_STANDARD_TARGET *)GET_TARGET(e);
  93.                         if (t->target.u.target_size
  94.                             != ALIGN(sizeof(STRUCT_STANDARD_TARGET))) {
  95. +                               free(r);
  96.                                 errno = EINVAL;
  97.                                 return -1;
  98.                         }
  99. @@ -2120,6 +2121,7 @@ TC_COMMIT(TC_HANDLE_T *handle)
  100.                 errno = ret;
  101.                 free(repl->counters);
  102.                 free(repl);
  103. +               free(newcounters);
  104.                 return 0;
  105.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement