{"action":"created","issue":{"url":"https://api.github.com/repos/littlstar/b64.c/issues/6","labels_url":"https://api.github.com/repos/littlstar/b64.c/issues/6/labels{/name}","comments_url":"https://api.github.com/repos/littlstar/b64.c/issues/6/comments","events_url":"https://api.github.com/repos/littlstar/b64.c/issues/6/events","html_url":"https://github.com/littlstar/b64.c/issues/6","id":58969114,"number":6,"title":"tests failing when run via valgrind(1)","user":{"login":"stephenmathieson","id":571265,"avatar_url":"https://avatars.githubusercontent.com/u/571265?v=3","gravatar_id":"","url":"https://api.github.com/users/stephenmathieson","html_url":"https://github.com/stephenmathieson","followers_url":"https://api.github.com/users/stephenmathieson/followers","following_url":"https://api.github.com/users/stephenmathieson/following{/other_user}","gists_url":"https://api.github.com/users/stephenmathieson/gists{/gist_id}","starred_url":"https://api.github.com/users/stephenmathieson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stephenmathieson/subscriptions","organizations_url":"https://api.github.com/users/stephenmathieson/orgs","repos_url":"https://api.github.com/users/stephenmathieson/repos","events_url":"https://api.github.com/users/stephenmathieson/events{/privacy}","received_events_url":"https://api.github.com/users/stephenmathieson/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-02-25T21:01:13Z","updated_at":"2015-02-25T21:09:23Z","closed_at":null,"body":"```\r\nstephenmathieson at UTA in ~/repos/github.com/littlstar/b64.c on master\r\n$ valgrind ./test\r\n==1936== Memcheck, a memory error detector\r\n==1936== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.\r\n==1936== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info\r\n==1936== Command: ./test\r\n==1936== \r\n==1936== Invalid write of size 1\r\n==1936==    at 0x400E13: b64_encode (in ~/repos/github.com/littlstar/b64.c/test)\r\n==1936==    by 0x400815: main (in ~/repos/github.com/littlstar/b64.c/test)\r\n==1936==  Address 0x51f1128 is 0 bytes after a block of size 8 alloc'd\r\n==1936==    at 0x4C2B7B2: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)\r\n==1936==    by 0x400DED: b64_encode (in ~/repos/github.com/littlstar/b64.c/test)\r\n==1936==    by 0x400815: main (in ~/repos/github.com/littlstar/b64.c/test)\r\n==1936== \r\n==1936== Invalid write of size 1\r\n==1936==    at 0x400E4D: b64_encode (in ~/repos/github.com/littlstar/b64.c/test)\r\n==1936==    by 0x400815: main (in ~/repos/github.com/littlstar/b64.c/test)\r\n==1936==  Address 0x51f11ca is 0 bytes after a block of size 10 alloc'd\r\n==1936==    at 0x4C2B7B2: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)\r\n==1936==    by 0x400E3D: b64_encode (in ~/repos/github.com/littlstar/b64.c/test)\r\n==1936==    by 0x400815: main (in ~/repos/github.com/littlstar/b64.c/test)\r\n==1936== \r\n==1936== Conditional jump or move depends on uninitialised value(s)\r\n==1936==    at 0x400826: main (in ~/repos/github.com/littlstar/b64.c/test)\r\n==1936== \r\n==1936== Conditional jump or move depends on uninitialised value(s)\r\n==1936==    at 0x400839: main (in ~/repos/github.com/littlstar/b64.c/test)\r\n==1936== \r\ntest: test.c:28: main: Assertion `0 == strcmp(\"YnJhZGxleQ==\", (char *) b64_encode((const unsigned char *) \"bradley\", strlen((char *) (const unsigned char *) \"bradley\")))' failed.\r\n==1936== \r\n==1936== HEAP SUMMARY:\r\n==1936==     in use at exit: 13 bytes in 1 blocks\r\n==1936==   total heap usage: 11 allocs, 10 frees, 643 bytes allocated\r\n==1936== \r\n==1936== LEAK SUMMARY:\r\n==1936==    definitely lost: 13 bytes in 1 blocks\r\n==1936==    indirectly lost: 0 bytes in 0 blocks\r\n==1936==      possibly lost: 0 bytes in 0 blocks\r\n==1936==    still reachable: 0 bytes in 0 blocks\r\n==1936==         suppressed: 0 bytes in 0 blocks\r\n==1936== Rerun with --leak-check=full to see details of leaked memory\r\n==1936== \r\n==1936== For counts of detected and suppressed errors, rerun with: -v\r\n==1936== Use --track-origins=yes to see where uninitialised values come from\r\n==1936== ERROR SUMMARY: 6 errors from 4 contexts (suppressed: 2 from 2)\r\nAborted\r\nstephenmathieson at UTA in ~/repos/github.com/littlstar/b64.c on master\r\n$ \r\n```"},"comment":{"url":"https://api.github.com/repos/littlstar/b64.c/issues/comments/76058937","html_url":"https://github.com/littlstar/b64.c/issues/6#issuecomment-76058937","issue_url":"https://api.github.com/repos/littlstar/b64.c/issues/6","id":76058937,"user":{"login":"jwerle","id":1462973,"avatar_url":"https://avatars.githubusercontent.com/u/1462973?v=3","gravatar_id":"","url":"https://api.github.com/users/jwerle","html_url":"https://github.com/jwerle","followers_url":"https://api.github.com/users/jwerle/followers","following_url":"https://api.github.com/users/jwerle/following{/other_user}","gists_url":"https://api.github.com/users/jwerle/gists{/gist_id}","starred_url":"https://api.github.com/users/jwerle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jwerle/subscriptions","organizations_url":"https://api.github.com/users/jwerle/orgs","repos_url":"https://api.github.com/users/jwerle/repos","events_url":"https://api.github.com/users/jwerle/events{/privacy}","received_events_url":"https://api.github.com/users/jwerle/received_events","type":"User","site_admin":false},"created_at":"2015-02-25T21:09:23Z","updated_at":"2015-02-25T21:09:23Z","body":"yeah.. this needs to be refactored\r\n[this](https://github.com/littlstar/b64.c/blob/master/encode.c#L41) is bad\r\n\r\nthis would probably solve it:\r\n\r\n```c\r\ntmp = (char *) realloc(enc, size + 4);\r\nif (NULL != tmp) {\r\n  enc = tmp;\r\n}\r\n```"}}