summaryrefslogtreecommitdiff
path: root/shared/config-parser.c
diff options
context:
space:
mode:
authorMun Gwan-gyeong <elongbug@gmail.com>2013-05-25 02:09:13 +0900
committerKristian Høgsberg <krh@bitplanet.net>2013-05-26 20:07:47 -0400
commit72a3ab7b8592476157c15420897227f75e39421a (patch)
tree73ef50e35595ca37e2c2d66c613f3ef636ccf7ef /shared/config-parser.c
parentd664196cfb8e229de10099f51c175de40cc05396 (diff)
downloadweston-72a3ab7b8592476157c15420897227f75e39421a.tar.gz
config-parser: Avoid null dereference when handling config-parser
backtrace: (gdb) bt #0 weston_config_get_section (config=0x0, section=0x8062f31 "keyboard", key=0x0, value=0x0) at config-parser.c:265 #1 0x080535a1 in weston_compositor_init (ec=0x905b690, display=0x9056490, argc=0xbf8bd2f0, argv=0xbf8bd384, config_fd=-1) at compositor.c:2819 #2 0xb75d72bb in x11_compositor_create (config_fd=-1, argv=0xbf8bd384, argc=<optimized out>, use_pixman=0, no_input=0, fullscreen=0, display=0x9056490) at compositor-x11.c:1527 #3 backend_init (display=0x9056490, argc=0xbf8bd2f0, argv=0xbf8bd384, config_fd=-1) at compositor-x11.c:1746
Diffstat (limited to 'shared/config-parser.c')
-rw-r--r--shared/config-parser.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/shared/config-parser.c b/shared/config-parser.c
index 5ef6f03b..9772c12a 100644
--- a/shared/config-parser.c
+++ b/shared/config-parser.c
@@ -262,6 +262,8 @@ weston_config_get_section(struct weston_config *config, const char *section,
struct weston_config_section *s;
struct weston_config_entry *e;
+ if (config == NULL)
+ return NULL;
wl_list_for_each(s, &config->section_list, link) {
if (strcmp(s->name, section) != 0)
continue;