cpp: Fix init of string from null
* lang/cpp/src/key.cpp (UserID::addrSpecFromString): Check return value before creating the string.
This commit is contained in:
parent
f526d0e22e
commit
1e8c34a919
@ -884,9 +884,12 @@ std::string UserID::addrSpecFromString(const char *userid)
|
||||
return std::string();
|
||||
}
|
||||
char *normalized = gpgme_addrspec_from_uid (userid);
|
||||
std::string ret(normalized);
|
||||
gpgme_free(normalized);
|
||||
return ret;
|
||||
if (normalized) {
|
||||
std::string ret(normalized);
|
||||
gpgme_free(normalized);
|
||||
return ret;
|
||||
}
|
||||
return std::string();
|
||||
}
|
||||
|
||||
std::string UserID::addrSpec() const
|
||||
|
Loading…
Reference in New Issue
Block a user