libplatforminfo: make sanitize_image_name() fail gracefully

Some targets may not always have a /tmp/sysinfo/model, don't crash in this
case.
This commit is contained in:
Matthias Schiffer 2017-02-12 05:36:08 +01:00
parent 03f06248c9
commit f2885547ff
No known key found for this signature in database
GPG Key ID: 16EF3F64CB201D9C
1 changed files with 5 additions and 0 deletions

View File

@ -61,6 +61,11 @@ __attribute__((unused)) static char * read_line(const char *filename) {
}
__attribute__((unused)) static void sanitize_image_name(char **outp, char *in) {
if (!in) {
*outp = NULL;
return;
}
char *out = malloc(strlen(in) + 1);
*outp = out;