- see realloc man :
The realloc() function returns a pointer to the newly allocated memory, which is suitably aligned for any kind of variable and may be different from ptr, or NULL if the request fails. If size was equal to 0, either NULL or a pointer suitable to be passed to free() is returned. If realloc() fails the original block is left untouched; it is not freed or moved.
int err_no = 0;
char err_buf[100] = { 0, };
int func_ret = VCONF_OK;
+ char tmp;
INFO("_vconf_get_key_elektra_format start");
{
if(value) {
value_size = value_size + strlen(file_buf);
- value = (char *) realloc(value, value_size);
- if(value == NULL) {
+ tmp = (char *) realloc(value, value_size);
+ if(!tmp) {
+ free(value);
func_ret = VCONF_ERROR_NO_MEM;
break;
}
+ value = tmp;
strncat(value, file_buf, strlen(file_buf));
} else {
value_size = strlen(file_buf) + 1;