4209. [bug] Address resource leaks in dlz modules. [RT #40654]

This commit is contained in:
Mark Andrews
2015-09-17 13:19:35 +10:00
parent dc9edc1332
commit 7b1f63dcd1
3 changed files with 13 additions and 4 deletions

View File

@@ -1,3 +1,5 @@
4209. [bug] Address resource leaks in dlz modules. [RT #40654]
4208. [bug] Address null pointer dereferences on out of memory.
[RT #40764]

View File

@@ -617,7 +617,8 @@ dlz_allnodes(const char *zone, void *dbdata, dns_sdlzallnodes_t *allnodes) {
DLZ_LIST_INIT(*dir_list);
if (create_path(zone, NULL, NULL, cd, &basepath) != ISC_R_SUCCESS) {
return (ISC_R_NOTFOUND);
result = ISC_R_NOTFOUND;
goto complete_allnds;
}
/* remove path separator at end of path so stat works properly */
@@ -852,14 +853,16 @@ dlz_create(const char *dlzname, unsigned int argc, char *argv[],
cd->log(ISC_LOG_ERROR,
"Filesystem driver requires "
"6 command line args.");
return (ISC_R_FAILURE);
result = ISC_R_FAILURE;
goto free_cd;
}
if (strlen(argv[5]) > 1) {
cd->log(ISC_LOG_ERROR,
"Filesystem driver can only "
"accept a single character for separator.");
return (ISC_R_FAILURE);
result = ISC_R_FAILURE;
goto free_cd;
}
/* verify base dir ends with '/' or '\' */
@@ -869,7 +872,8 @@ dlz_create(const char *dlzname, unsigned int argc, char *argv[],
"Base dir parameter for filesystem driver "
"should end with %s",
"either '/' or '\\' ");
return (ISC_R_FAILURE);
result = ISC_R_FAILURE;
goto free_cd;
}
/* determine and save path separator for later */
@@ -923,6 +927,7 @@ dlz_create(const char *dlzname, unsigned int argc, char *argv[],
"filesystem_dynamic: Filesystem driver unable to "
"allocate memory for config data.");
free_cd:
/* if we allocated a config data object clean it up */
if (cd != NULL)
dlz_destroy(cd);

View File

@@ -566,6 +566,7 @@ dlz_create(const char *dlzname, unsigned int argc, char *argv[],
cd->log(ISC_LOG_ERROR,
"DLZ Perl '%s': Missing script argument.",
dlzname);
free(cd);
return (ISC_R_FAILURE);
}
@@ -573,6 +574,7 @@ dlz_create(const char *dlzname, unsigned int argc, char *argv[],
cd->log(ISC_LOG_ERROR,
"DLZ Perl '%s': Missing class name argument.",
dlzname);
free(cd);
return (ISC_R_FAILURE);
}
perl_class_name = argv[2];