Signed-off-by: Daniel Lezcano <daniel.lezc...@free.fr>
---
 powerdebug.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/powerdebug.c b/powerdebug.c
index efdb1a2..05c0e34 100644
--- a/powerdebug.c
+++ b/powerdebug.c
@@ -85,7 +85,7 @@ struct powerdebug_options {
        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 @@ int getoptions(int argc, char *argv[], struct 
powerdebug_options *options)
                        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);
-- 
1.7.1


_______________________________________________
linaro-dev mailing list
linaro-dev@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/linaro-dev

Reply via email to