From 44186b522f3083c10b8a96c6f9f815febeead054 Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Fri, 18 Nov 2011 21:23:33 -0500 Subject: scanner: Only strdup interface_name after making sure it's not NULL --- src/scanner.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') 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) -- cgit v1.2.3