]> git.proxmox.com Git - mirror_frr.git/blobdiff - lib/clippy.c
Merge pull request #5793 from ton31337/fix/formatting_show_bgp_summary_failed
[mirror_frr.git] / lib / clippy.c
index bcec6c2ccab3113a76183729b2047e642445686e..cd8067f5ebfd34b43b029fa3a864d59198604025 100644 (file)
 #define pychar wchar_t
 static wchar_t *wconv(const char *s)
 {
-       size_t outlen = mbstowcs(NULL, s, 0);
+       size_t outlen = s ? mbstowcs(NULL, s, 0) : 0;
        wchar_t *out = malloc((outlen + 1) * sizeof(wchar_t));
-       mbstowcs(out, s, outlen + 1);
+
+       if (outlen > 0)
+               mbstowcs(out, s, outlen);
        out[outlen] = 0;
        return out;
 }
@@ -83,8 +85,6 @@ int main(int argc, char **argv)
        if (PyRun_AnyFile(fp, pyfile)) {
                if (PyErr_Occurred())
                        PyErr_Print();
-               else
-                       printf("unknown python failure (?)\n");
                return 1;
        }
        Py_Finalize();