/* realpath("") returns CWD */
if (!*path) {
new_state.cwd = (char*)malloc(1);
+ if (!new_state.cwd) {
+ zend_accel_error(ACCEL_LOG_ERROR, "malloc() failed");
+ return NULL;
+ }
new_state.cwd[0] = '\0';
new_state.cwd_length = 0;
if ((cwd = accel_getcwd(&cwd_len TSRMLS_CC)) != NULL) {
} else if (!IS_ABSOLUTE_PATH(path, path_len) &&
(cwd = accel_getcwd(&cwd_len TSRMLS_CC)) != NULL) {
new_state.cwd = zend_strndup(cwd, cwd_len);
+ if (!new_state.cwd) {
+ zend_accel_error(ACCEL_LOG_ERROR, "malloc() failed");
+ return NULL;
+ }
new_state.cwd_length = cwd_len;
} else {
new_state.cwd = (char*)malloc(1);
+ if (!new_state.cwd) {
+ zend_accel_error(ACCEL_LOG_ERROR, "malloc() failed");
+ return NULL;
+ }
new_state.cwd[0] = '\0';
new_state.cwd_length = 0;
}
char *errbuf;
int errsize = regerror(reg_err, comp_regex, NULL, 0);
errbuf = malloc(errsize);
-
+ if (!errbuf) {
+ zend_accel_error(ACCEL_LOG_ERROR, "Blacklist compilation: no memory\n");
+ return;
+ }
regerror(reg_err, comp_regex, errbuf, errsize);
zend_accel_error(ACCEL_LOG_ERROR, "Blacklist compilation: %s\n", errbuf);
free(errbuf);
/* don't create a regexp buffer bigger than 12K)*/
if((i+1 == blacklist->pos) || ((rlen+blacklist->entries[i+1].path_length*2+2)>(12*1024) ) ) {
regexp = (char *)malloc(rlen);
+ if (!regexp) {
+ zend_accel_error(ACCEL_LOG_ERROR, "malloc() failed\n");
+ return;
+ }
regexp[0] = '^';
regexp[1] = '(';
regexp[clen] = '\0';
(*regexp_list_it) = malloc(sizeof(zend_regexp_list));
+ if (!*regexp_list_it) {
+ zend_accel_error(ACCEL_LOG_ERROR, "malloc() failed\n");
+ return;
+ }
(*regexp_list_it)->next = NULL;
if ((reg_err = regcomp(&((*regexp_list_it)->comp_regex), regexp, REGEX_MODE)) != 0) {
zend_accel_blacklist_allocate(blacklist);
blacklist->entries[blacklist->pos].path_length = path_length;
blacklist->entries[blacklist->pos].path = (char *) malloc(path_length+1);
+ if (!blacklist->entries[blacklist->pos].path) {
+ zend_accel_error(ACCEL_LOG_ERROR, "malloc() failed\n");
+ return;
+ }
blacklist->entries[blacklist->pos].id = blacklist->pos;
memcpy(blacklist->entries[blacklist->pos].path, real_path, path_length+1);
blacklist->pos++;