Skip to content
Snippets Groups Projects
Commit 8134ec8627e7 authored by Jim Hague's avatar Jim Hague
Browse files

bdiff: fix malloc(0) issue in fixws()

If fixws() is called on a zero-length string, malloc(0) is called and
expected to return a pointer. Which it does on e.g. Linux. AIX returns
NULL, which it is also legal, but the malloc() is then assumed to have
failed. So ensure a valid pointer is always returned.
parent f11eee00c652
No related branches found
No related tags found
No related merge requests found
......@@ -443,7 +443,7 @@
r = PyBytes_AsString(s);
rlen = PyBytes_Size(s);
w = (char *)malloc(rlen);
w = (char *)malloc(rlen ? rlen : 1);
if (!w)
goto nomem;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment