diff options
author | Kristian Høgsberg <krh@bitplanet.net> | 2011-11-18 21:23:33 -0500 |
---|---|---|
committer | Kristian Høgsberg <krh@bitplanet.net> | 2011-11-18 21:23:33 -0500 |
commit | 44186b522f3083c10b8a96c6f9f815febeead054 (patch) | |
tree | 6e5b047dc0b339ec221149eadc8ab63d712bb9f1 | |
parent | cf04b0a18f25cf1161c84f8ba979805eeaadea09 (diff) |
scanner: Only strdup interface_name after making sure it's not NULL
-rw-r--r-- | src/scanner.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/scanner.c b/src/scanner.c index 5f85396..d0b555c 100644 --- a/src/scanner.c +++ b/src/scanner.c @@ -231,10 +231,8 @@ start_element(void *data, const char *element_name, const char **atts) arg->type = FD; else if (strcmp(type, "new_id") == 0) { arg->type = NEW_ID; - arg->interface_name = strdup(interface_name); } else if (strcmp(type, "object") == 0) { arg->type = OBJECT; - arg->interface_name = strdup(interface_name); } else { fail(ctx, "unknown type"); } @@ -244,6 +242,7 @@ start_element(void *data, const char *element_name, const char **atts) case OBJECT: if (interface_name == NULL) fail(ctx, "no interface name given"); + arg->interface_name = strdup(interface_name); break; default: if (interface_name != NULL) |