From c7a79fafa3fdaf3c6c33ad50f0a13f3890b2da08 Mon Sep 17 00:00:00 2001 From: Joel Grunbaum <joelgrun@gmail.com> Date: Sun, 18 Oct 2020 12:27:31 +0000 Subject: [PATCH] fixed memory leaks --- main.c | 43 +++---------------------------------------- 1 files changed, 3 insertions(+), 40 deletions(-) diff --git a/main.c b/main.c index 15ea1d1..1e36b9e 100644 --- a/main.c +++ b/main.c @@ -1,44 +1,7 @@ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <sys/socket.h> -#include <arpa/inet.h> -#include <netint/in.h> -//#include <netdb.h> -#include <sys/time.h> - -// DNS resource records -#define T_A 1 // IPv4 address -#define T_NS // Name Server -#define T_CNAME 5 // Cannonical name -#define T_SOA 6 // State of Authority -#define T_PTR 12 // Domain name pointer -#define T_MX 15 // Mail exchange - -struct DNS_QUERY -{ - unsigned short id; //ID number - unsigned char rd :1; //recursion - unsigned char aa :1; //truncated message - unsigned char opcode :4; //message purpose - unsigned char qr :1; //query/response - unsigned char rcode :4; //response code - -} +#include "dns.h" int main(int argc, char** argv) { - -} - -void resolve(char* hostname, char* dns_ip) -{ - int s; - struct sockaddr_in dest; - - s = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); - dest.sin_family = AF_INET; - dest.sin_port = htons(53); - dest.sin_addr.s_addr = inet_addr(dns_ip); - + resolve("google.com", "1.1.1.1", T_A, 1); + return 0; } -- Gitblit v1.10.0