Commit 769664a1 authored by Mark Andrews's avatar Mark Andrews
Browse files

Merge branch...

Merge branch '1207-bind-potential-for-null-pointer-de-references-plus-memory-leaks-cwe-476-in-file-dlz_mysqldyn_mod-c' into 'master'

Resolve "BIND | Potential for NULL pointer de-references plus memory leaks (CWE-476) in file 'dlz_mysqldyn_mod.c'"

Closes #1207

See merge request !2299
parents a48a612d 8b65ac91
5286. [contrib] Address potential NULL pointer dereferences in
dlz_mysqldyn_mod.c. [GL #1207]
5285. [port] win32: implement "-T maxudpXXX". [GL #837] 5285. [port] win32: implement "-T maxudpXXX". [GL #837]
   
5284. [func] Added +unexpected command line option to dig. 5284. [func] Added +unexpected command line option to dig.
......
...@@ -1297,9 +1297,21 @@ dlz_newversion(const char *zone, void *dbdata, void **versionp) { ...@@ -1297,9 +1297,21 @@ dlz_newversion(const char *zone, void *dbdata, void **versionp) {
* Create new transaction * Create new transaction
*/ */
newtx = (mysql_transaction_t *) newtx = (mysql_transaction_t *)
malloc(sizeof(mysql_transaction_t)); calloc(1, sizeof(mysql_transaction_t));
if (newtx == NULL) {
result = ISC_R_NOMEMORY;
goto cleanup;
}
newtx->zone = strdup(zone); newtx->zone = strdup(zone);
if (newtx->zone == NULL) {
result = ISC_R_NOMEMORY;
goto cleanup;
}
newtx->zone_id = strdup(zone_id); newtx->zone_id = strdup(zone_id);
if (newtx->zone_id == NULL) {
result = ISC_R_NOMEMORY;
goto cleanup;
}
newtx->dbi = get_dbi(state); newtx->dbi = get_dbi(state);
newtx->next = NULL; newtx->next = NULL;
...@@ -1329,9 +1341,15 @@ dlz_newversion(const char *zone, void *dbdata, void **versionp) { ...@@ -1329,9 +1341,15 @@ dlz_newversion(const char *zone, void *dbdata, void **versionp) {
*versionp = (void *) newtx; *versionp = (void *) newtx;
} else { } else {
dlz_mutex_unlock(&state->tx_mutex); dlz_mutex_unlock(&state->tx_mutex);
free(newtx->zone); if (newtx != NULL) {
free(newtx->zone_id); if (newtx->zone != NULL) {
free(newtx); free(newtx->zone);
}
if (newtx->zone != NULL) {
free(newtx->zone_id);
}
free(newtx);
}
} }
return (result); return (result);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment