Commit 1cc87b3f authored by Thomas Jahns's avatar Thomas Jahns 🤸
Browse files

Minor fix for gribCopyString.

* Correct return value when grib_get_length is available.
* Fix coding style.
parent 719c3678
...@@ -60,13 +60,14 @@ char* gribCopyString(grib_handle* gribHandle, const char* key) ...@@ -60,13 +60,14 @@ char* gribCopyString(grib_handle* gribHandle, const char* key)
break; break;
} }
if (!rc) if (!rc)
{
result = xrealloc(result, length); result = xrealloc(result, length);
return result; else
} {
free(result); free(result);
result = NULL;
}
#endif #endif
return NULL; return result;
} }
//A simple wrapper for grib_get_string() for the usecase that the result is only compared to a given constant string. //A simple wrapper for grib_get_string() for the usecase that the result is only compared to a given constant string.
......
...@@ -1424,3 +1424,12 @@ tableDefault(void) ...@@ -1424,3 +1424,12 @@ tableDefault(void)
} }
#endif /* _TABLE_H */ #endif /* _TABLE_H */
/*
* Local Variables:
* c-file-style: "Java"
* c-basic-offset: 2
* indent-tabs-mode: nil
* show-trailing-whitespace: t
* require-trailing-newline: t
* End:
*/
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment