]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Fix memleak in testcode for testbound (if it fails).
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Mon, 29 Jul 2013 07:32:35 +0000 (07:32 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Mon, 29 Jul 2013 07:32:35 +0000 (07:32 +0000)
- Fix NSS returned arrays out of setup function to be statics.

git-svn-id: file:///svn/unbound/trunk@2930 be551aaa-1e26-0410-a405-d3ace91eadb9

doc/Changelog
testcode/fake_event.c
validator/val_secalgo.c

index 5c0f1d25ef31d08e9ab4d7f1eec78902f6fe3ad0..829d68671ea983be5a2d6f750f7bae88a4c6c786 100644 (file)
@@ -1,3 +1,7 @@
+29 Jun 2013: Wouter
+       - Fix memleak in testcode for testbound (if it fails).
+       - Fix NSS returned arrays out of setup function to be statics.
+
 26 Jun 2013: Wouter
        - max include of 100.000 files (depth and globbed at one time).
          This is to preserve system memory in bug cases, or endless cases.
index 180ff30697e2a08cd4e52b4cd35d7a4fe0a5d11e..39bb19822fa8d795b808e67edc91a72b2afc8cf2 100644 (file)
@@ -909,8 +909,10 @@ outside_network_create(struct comm_base* base, size_t bufsize,
        runtime->infra = infra;
        outnet->base = base;
        outnet->udp_buff = ldns_buffer_new(bufsize);
-       if(!outnet->udp_buff)
+       if(!outnet->udp_buff) {
+               free(outnet);
                return NULL;
+       }
        return outnet;
 }
 
index 5cca578b1be150b0d6baff58bff13e383a65b8c9..92fd0cc4c8c20db96ccc411625cb78c2a97e3d36 100644 (file)
@@ -669,12 +669,12 @@ static SECKEYPublicKey* nss_buf2ecdsa(unsigned char* key, size_t len, int algo)
        SECKEYPublicKey* pk;
        SECItem pub = {siBuffer, NULL, 0};
        SECItem params = {siBuffer, NULL, 0};
-       unsigned char param256[] = {
+       static unsigned char param256[] = {
                /* OBJECTIDENTIFIER 1.2.840.10045.3.1.7 (P-256)
                 * {iso(1) member-body(2) us(840) ansi-x962(10045) curves(3) prime(1) prime256v1(7)} */
                0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07
        };
-       unsigned char param384[] = {
+       static unsigned char param384[] = {
                /* OBJECTIDENTIFIER 1.3.132.0.34 (P-384)
                 * {iso(1) identified-organization(3) certicom(132) curve(0) ansip384r1(34)} */
                0x06, 0x05, 0x2b, 0x81, 0x04, 0x00, 0x22
@@ -845,19 +845,19 @@ nss_setup_key_digest(int algo, SECKEYPublicKey** pubkey, HASH_HashType* htype,
        /* uses libNSS */
 
        /* hash prefix for md5, RFC2537 */
-       unsigned char p_md5[] = {0x30, 0x20, 0x30, 0x0c, 0x06, 0x08, 0x2a,
+       static unsigned char p_md5[] = {0x30, 0x20, 0x30, 0x0c, 0x06, 0x08, 0x2a,
        0x86, 0x48, 0x86, 0xf7, 0x0d, 0x02, 0x05, 0x05, 0x00, 0x04, 0x10};
        /* hash prefix to prepend to hash output, from RFC3110 */
-       unsigned char p_sha1[] = {0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2B,
+       static unsigned char p_sha1[] = {0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2B,
                0x0E, 0x03, 0x02, 0x1A, 0x05, 0x00, 0x04, 0x14};
        /* from RFC5702 */
-       unsigned char p_sha256[] = {0x30, 0x31, 0x30, 0x0d, 0x06, 0x09, 0x60,
+       static unsigned char p_sha256[] = {0x30, 0x31, 0x30, 0x0d, 0x06, 0x09, 0x60,
        0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 0x00, 0x04, 0x20};
-       unsigned char p_sha512[] = {0x30, 0x51, 0x30, 0x0d, 0x06, 0x09, 0x60,
+       static unsigned char p_sha512[] = {0x30, 0x51, 0x30, 0x0d, 0x06, 0x09, 0x60,
        0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x03, 0x05, 0x00, 0x04, 0x40};
        /* from RFC6234 */
        /* for future RSASHA384 .. 
-       unsigned char p_sha384[] = {0x30, 0x51, 0x30, 0x0d, 0x06, 0x09, 0x60,
+       static unsigned char p_sha384[] = {0x30, 0x51, 0x30, 0x0d, 0x06, 0x09, 0x60,
        0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x02, 0x05, 0x00, 0x04, 0x30};
        */