]> granicus.if.org Git - php/commitdiff
New function dns_get_record(): close resolver socket after use.
authorSara Golemon <pollita@php.net>
Sat, 23 Nov 2002 01:09:07 +0000 (01:09 +0000)
committerSara Golemon <pollita@php.net>
Sat, 23 Nov 2002 01:09:07 +0000 (01:09 +0000)
fix to internal func php_parserr(): correct bug in return state.

ext/standard/dns.c

index cb68897944d349f38530aa5b91de50a346e36834..cd55fb36180cf16ae4709c9f37a882842d3f5bfa 100644 (file)
@@ -331,8 +331,9 @@ static u_char *php_parserr(u_char *cp, querybuf *answer, int type_to_fetch, int
        GETLONG(ttl, cp);
        GETSHORT(dlen, cp);
        if (type_to_fetch != T_ANY && type != type_to_fetch) {
-               /* Should never actually occour */
-               return NULL;
+               *subarray = NULL;
+               cp += dlen;
+               return cp;
        }
 
        if (!store) {
@@ -576,6 +577,7 @@ PHP_FUNCTION(dns_get_record)
                                        zend_hash_next_index_insert(HASH_OF(return_value), (void *)&subarray[current_subarray], sizeof(zval *), NULL);
                                current_subarray++;
                        }
+                       res_nclose(&res);
                }
        }