Message ID | 1461913214-15900-1-git-send-email-trenn@suse.com (mailing list archive) |
---|---|
State | Accepted, archived |
Delegated to: | Rafael Wysocki |
Headers | show |
On Friday, April 29, 2016 09:00:14 AM Thomas Renninger wrote: > From: Arjun Sreedharan <arjun024@gmail.com> > > Signed-off-by: Thomas Renninger <trenn@suse.com> Applied, thanks! -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/tools/power/cpupower/bench/parse.c b/tools/power/cpupower/bench/parse.c index 2d09c92..9b65f05 100644 --- a/tools/power/cpupower/bench/parse.c +++ b/tools/power/cpupower/bench/parse.c @@ -65,7 +65,7 @@ FILE *prepare_output(const char *dirname) { FILE *output = NULL; int len; - char *filename; + char *filename, *filename_tmp; struct utsname sysdata; DIR *dir; @@ -88,13 +88,15 @@ FILE *prepare_output(const char *dirname) if (uname(&sysdata) == 0) { len += strlen(sysdata.nodename) + strlen(sysdata.release); - filename = realloc(filename, sizeof(char) * len); + filename_tmp = realloc(filename, sizeof(*filename) * len); - if (!filename) { + if (filename_tmp == NULL) { + free(filename); perror("realloc"); goto out_dir; } + filename = filename_tmp; snprintf(filename, len - 1, "%s/benchmark_%s_%s_%li.log", dirname, sysdata.nodename, sysdata.release, time(NULL)); } else {