Skip to content

Commit

Permalink
channel:don't unnecessarily create a list for CNAME results
Browse files Browse the repository at this point in the history
  • Loading branch information
saghul committed Aug 30, 2015
1 parent 981b017 commit c56dfb5
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions src/cares.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ query_cname_cb(void *arg, int status,int timeouts, unsigned char *answer_buf, in
PyGILState_STATE gstate = PyGILState_Ensure();
int parse_status;
struct hostent *hostent = NULL;
PyObject *dns_result, *errorno, *tmp, *result, *callback;
PyObject *dns_result, *errorno, *result, *callback;

callback = (PyObject *)arg;
ASSERT(callback);
Expand All @@ -230,20 +230,8 @@ query_cname_cb(void *arg, int status,int timeouts, unsigned char *answer_buf, in
goto callback;
}

dns_result = PyList_New(0);
if (!dns_result) {
PyErr_NoMemory();
PyErr_WriteUnraisable(Py_None);
errorno = PyInt_FromLong((long)ARES_ENOMEM);
dns_result = Py_None;
Py_INCREF(Py_None);
goto callback;
}

/* TODO: add TTL */
tmp = Py_BuildValue("s", hostent->h_name);
PyList_Append(dns_result, tmp);
Py_DECREF(tmp);
dns_result = Py_BuildValue("s", hostent->h_name);
errorno = Py_None;
Py_INCREF(Py_None);

Expand Down

0 comments on commit c56dfb5

Please sign in to comment.