- Timestamp:
- 01/23/09 12:29:51 (16 years ago)
- Location:
- trunk/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/common.c
r134 r136 52 52 53 53 unsigned int buf_len = sizeof(char)*(len+1); 54 char* ret_val = malloc(buf_len);54 char* ret_val = NULL; 55 55 char* tmp_buf; 56 56 57 if(buf_len > 0) 58 ret_val = malloc(buf_len); 57 59 if(ret_val == NULL) 58 60 return NULL; … … 155 157 { 156 158 char* ret_val; 157 char* ascii ;159 char* ascii = NULL; 158 160 char* tmp_err; 159 161 int ret_err; 160 162 *error_msg = NULL; 161 163 162 ascii = malloc(length+1); 164 if(length+1 > 0) 165 ascii = malloc(length+1); 163 166 if(ascii == NULL) 164 167 { … … 175 178 free(ascii); 176 179 tmp_err = strerror(-ret_err); 177 *error_msg = (char*)malloc( 54+strlen(tmp_err));180 *error_msg = (char*)malloc(61+strlen(tmp_err)); 178 181 if(*error_msg == NULL) 179 { 180 free(ascii); 181 return NULL; 182 } 182 return NULL; 183 183 184 184 sprintf(*error_msg, … … 305 305 { 306 306 tmp_err = strerror(-ret_err); 307 *error_msg = (char*)malloc( 54+strlen(tmp_err));307 *error_msg = (char*)malloc(61+strlen(tmp_err)); 308 308 if(*error_msg == NULL) 309 { 310 free(ascii_tmp); 309 311 return NULL; 312 } 313 310 314 sprintf(*error_msg, "MULTI_SZ unicode conversion" 311 315 " failed with '%s'. Quoting as binary.", tmp_err); -
trunk/src/reglookup-recover.c
r135 r136 99 99 if(print_parsedraw) 100 100 free(quoted_raw); 101 free(quoted_name); 101 102 } 102 103 … … 829 830 tmp_path = (char*)malloc(strlen(parent_paths[i])+strlen(tmp_name)+2); 830 831 if(tmp_path == NULL) 832 { 833 free(tmp_name); 831 834 return 10; 835 } 836 832 837 sprintf(tmp_path, "%s/%s", parent_paths[i], tmp_name); 833 838 for(j=0; j < tmp_key->num_values; j++) -
trunk/src/reglookup.c
r135 r136 255 255 if((new_buf = realloc(buf, buf_len)) == NULL) 256 256 { 257 free(name); 257 258 free(buf); 258 259 free(iter); … … 372 373 const REGFI_NK_REC* sub = NULL; 373 374 char* path = NULL; 375 char* msgs = NULL; 374 376 int key_type = regfi_type_str2val("KEY"); 375 377 bool print_this = true; … … 377 379 root = cur = regfi_iterator_cur_key(iter); 378 380 sub = regfi_iterator_first_subkey(iter); 379 381 msgs = regfi_get_messages(iter->f); 382 if(msgs != NULL) 383 fprintf(stderr, "%s", msgs); 380 384 if(root == NULL) 381 385 bailOut(EX_DATAERR, "ERROR: root cannot be NULL.\n"); … … 455 459 /* Strip any potential value name at end of path */ 456 460 for(i=0; 457 (path[i] != NULL) && (path[i+1] != NULL) 458 && (i < REGFI_MAX_DEPTH+1+1); 461 (path[i] != NULL) && (path[i+1] != NULL) && (i < REGFI_MAX_DEPTH+1); 459 462 i++) 460 tmp_path[i] = path[i]; 461 463 { tmp_path[i] = path[i]; } 462 464 tmp_path[i] = NULL; 463 465 … … 471 473 if(print_verbose) 472 474 fprintf(stderr, "VERBOSE: Found final path element as root key.\n"); 475 free(tmp_path); 473 476 return 2; 474 477 }
Note: See TracChangeset
for help on using the changeset viewer.