A good practice to follow when bugs such as these are identified is to add tests which reproduce the bug; when they are made to pass, the tests remain as part of the program's test suite to guard against reintroducing similar bugs. That way, we gradually increase the number of valuable tests as we progress.
Our histogram maps char to int, which could potentially overflow (undefined behaviour again). We could use an unsigned type (which has well-defined overflow behaviour), but consider that we're only interested in whether the value is even or odd - so we could use a map from char to bool to store our values modulo-2.
Also, an unordered map is a pretty slow form of histogram. For reasonable systems, with CHAR_BIT in the 8-16 range, we could use a simple array or a bitset to store our values (though we'll need to convert the string's characters to unsigned char to avoid indexing out of range):
std::bitset<UCHAR_MAX+1> hist;
for (unsigned char c: a) {
hist[c] = !hist[c];hist.flip(c);
}
When we have done this, we can simply use bitset::count() (or std::count() on an array) to tell us how many characters appear an odd number of times.
#include <cassert>
#include <iostream>
int main()
{
assert(isPalinStr(""));
assert(isPalinStr("a"));
assert(isPalinStr("aa"));
assert(isPalinStr("aabb"));
assert(isPalinStr("abbcc"));
assert(isPalinStr("aabccdd"));
assert(isPalinStr("aabbccd"));
assert(!isPalinStr("ab"));
assert(!isPalinStr("abc"));
assert(!isPalinStr("abbb"));
assert(!isPalinStr("aabbcd"));
}