]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
column: fix mem leak [coverity scan]
authorKarel Zak <kzak@redhat.com>
Tue, 14 Jan 2014 16:53:22 +0000 (17:53 +0100)
committerKarel Zak <kzak@redhat.com>
Tue, 14 Jan 2014 16:55:05 +0000 (17:55 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
text-utils/column.c

index 2430ede9ec2773e733d1fb0f6b12ec5a54d38e4e..e34184e05097708933b1be8d0fafd104ba10abe1 100644 (file)
@@ -421,8 +421,10 @@ static wchar_t *mbs_to_wcs(const char *s)
                return NULL;
        wcs = xmalloc((n + 1) * sizeof(wchar_t));
        n = mbstowcs(wcs, s, n + 1);
-       if (n < 0)
+       if (n < 0) {
+               free(wcs);
                return NULL;
+       }
        return wcs;
 }
 #endif