ID: 3613605 - 'lib/ipmi_main.c' - call free() on pointer to static data

getpass() and getpassphrase() library functions return pointer to a static
data array. When free() is called on such pointer, it abnormally terminates
application.

Commit for Dmitry Bazhenov
This commit is contained in:
Zdenek Styblik 2013-05-22 10:16:59 +00:00
parent 44247a8743
commit 51dd9cf1f0

View File

@ -504,7 +504,6 @@ ipmi_main(int argc, char ** argv,
password = NULL; password = NULL;
} }
password = strdup(tmp_pass); password = strdup(tmp_pass);
free(tmp_pass);
tmp_pass = NULL; tmp_pass = NULL;
if (password == NULL) { if (password == NULL) {
lprintf(LOG_ERR, "%s: malloc failure", progname); lprintf(LOG_ERR, "%s: malloc failure", progname);
@ -560,7 +559,6 @@ ipmi_main(int argc, char ** argv,
kgkey = NULL; kgkey = NULL;
} }
kgkey = strdup(tmp_pass); kgkey = strdup(tmp_pass);
free(tmp_pass);
tmp_pass = NULL; tmp_pass = NULL;
if (kgkey == NULL) { if (kgkey == NULL) {
lprintf(LOG_ERR, "%s: malloc failure", progname); lprintf(LOG_ERR, "%s: malloc failure", progname);
@ -794,7 +792,6 @@ ipmi_main(int argc, char ** argv,
#endif #endif
if (tmp_pass != NULL) { if (tmp_pass != NULL) {
password = strdup(tmp_pass); password = strdup(tmp_pass);
free(tmp_pass);
tmp_pass = NULL; tmp_pass = NULL;
if (password == NULL) { if (password == NULL) {
lprintf(LOG_ERR, "%s: malloc failure", progname); lprintf(LOG_ERR, "%s: malloc failure", progname);