]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
ipcs: fix memory leak [coverity scan]
authorKarel Zak <kzak@redhat.com>
Thu, 12 Oct 2017 12:39:54 +0000 (14:39 +0200)
committerKarel Zak <kzak@redhat.com>
Thu, 12 Oct 2017 12:39:54 +0000 (14:39 +0200)
It's not important, but let's keep static analyzes happy.

Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/ipcutils.c

index 51fce7b447ccdf7bfa5c31a8787c0a0fac9372f4..a2b539ca81dc2f6462acf676cf7ddcb1a670035b 100644 (file)
@@ -517,9 +517,13 @@ void ipc_print_size(int unit, char *msg, uint64_t size, const char *end,
                printf(format, size / 1024);
                break;
        case IPC_UNIT_HUMAN:
+       {
+               char *tmp;
                sprintf(format, "%%%ds", width);
-               printf(format, size_to_human_string(SIZE_SUFFIX_1LETTER, size));
+               printf(format, (tmp = size_to_human_string(SIZE_SUFFIX_1LETTER, size)));
+               free(tmp);
                break;
+       }
        default:
                /* impossible occurred */
                abort();