1
1
set the tmp_str to NULL, so we don't have any double-free...
   Additionally, we should check for malloc returning NULL...

This commit was SVN r21228.
Этот коммит содержится в:
Rainer Keller 2009-05-14 00:21:15 +00:00
родитель 3f7f2b6f0f
Коммит 36ee105d6a

Просмотреть файл

@ -765,6 +765,10 @@ static int extract_env_vars(int prev_pid)
len = OPAL_PATH_MAX;
tmp_str = (char *) malloc(sizeof(char) * len);
if( NULL == tmp_str) {
exit_status = OPAL_ERR_OUT_OF_RESOURCE;
goto cleanup;
}
if( NULL == fgets(tmp_str, len, env_data) ) {
exit_status = OPAL_ERROR;
goto cleanup;
@ -777,6 +781,7 @@ static int extract_env_vars(int prev_pid)
"opal_cr: extract_env_vars: Error: Parameter too long (%s)\n",
tmp_str);
free(tmp_str);
tmp_str = NULL;
continue;
}