]> granicus.if.org Git - strace/commitdiff
2008-04-19 Dmitry V. Levin <ldv@altlinux.org>
authorDmitry V. Levin <ldv@altlinux.org>
Sat, 19 Apr 2008 14:12:49 +0000 (14:12 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Sat, 19 Apr 2008 14:12:49 +0000 (14:12 +0000)
* count.c (call_summary_pers): Check calloc() return value.
Signed-off-by: "Yang Zhiguo" <yzgcsu@cn.fujitsu.com>
ChangeLog
count.c

index ddde8c2724ec1f19c0c2383c413119917b637329..2150a45e9f253e3697444b500342bf0ddba26d14 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-04-19  Dmitry V. Levin <ldv@altlinux.org>
+
+       * count.c (call_summary_pers): Check calloc() return value.
+       Signed-off-by: "Yang Zhiguo" <yzgcsu@cn.fujitsu.com>
+
 2008-03-26  Roland McGrath  <roland@redhat.com>
 
        * strace.spec (strace64_arches): Add sparc64.
diff --git a/count.c b/count.c
index 493fea150c747ec66a20b3515b4f33413dc3da66..4e272a367a04c7cdceb2cdbe2028625a25266ef8 100644 (file)
--- a/count.c
+++ b/count.c
@@ -164,9 +164,14 @@ call_summary_pers(FILE *outf)
        double  percent;
        char   *dashes = "-------------------------";
        char    error_str[16];
-
        int    *sorted_count = calloc(sizeof(int), nsyscalls);
 
+       if (!sorted_count)
+       {
+               fprintf(stderr, "strace: out of memory for call summary\n");
+               return;
+       }
+
        call_cum = error_cum = tv_cum.tv_sec = tv_cum.tv_usec = 0;
        if (overhead.tv_sec == -1)
        {