save some bytes by allocating dynamically the string option
Signed-off-by: Daniel Lezcano <daniel.lezcano@free.fr>
Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org>
diff --git a/powerdebug.c b/powerdebug.c
index b3b682a..9f36b63 100644
--- a/powerdebug.c
+++ b/powerdebug.c
@@ -85,7 +85,7 @@
int sensors;
int clocks;
int ticktime;
- char clkarg[64];
+ char *clkarg;
};
int getoptions(int argc, char *argv[], struct powerdebug_options *options)
@@ -118,7 +118,11 @@
break;
case 'p':
options->findparent = 1;
- strcpy(options->clkarg, optarg);
+ options->clkarg = strdup(optarg);
+ if (!options->clkarg) {
+ fprintf(stderr, "failed to allocate memory");
+ return -1;
+ }
break;
case 't':
options->ticktime = strtod(optarg, NULL);