mirror of https://github.com/BOINC/boinc.git
LIB: Prevent the possible issue of dereferencing a NULL pointer.
This commit is contained in:
parent
daee3b66fc
commit
a91f4c6408
|
@ -623,17 +623,20 @@ bool XML_PARSER::parse_str(const char* start_tag, char* buf, int len) {
|
|||
// same, for std::string
|
||||
//
|
||||
bool XML_PARSER::parse_string(const char* start_tag, string& str) {
|
||||
bool flag = false;
|
||||
if (is_empty_string(parsed_tag, start_tag)) {
|
||||
str = "";
|
||||
return true;
|
||||
}
|
||||
if (strcmp(parsed_tag, start_tag)) return false;
|
||||
char *buf=(char *)malloc(MAX_XML_STRING);
|
||||
bool flag = parse_str_aux(start_tag, buf, MAX_XML_STRING);
|
||||
if (flag) {
|
||||
str = buf;
|
||||
if (buf) {
|
||||
flag = parse_str_aux(start_tag, buf, MAX_XML_STRING);
|
||||
if (flag) {
|
||||
str = buf;
|
||||
}
|
||||
free(buf);
|
||||
}
|
||||
free(buf);
|
||||
return flag;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue