From: Peter Johnson Date: Sun, 31 Oct 2004 04:18:37 +0000 (-0000) Subject: * linemgr.c (yasm_linemap_create): Initialize pointers in initial X-Git-Tag: v0.5.0rc1~199 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1feacb6483b213d8886ab480d79231e44bda9a23;p=yasm * linemgr.c (yasm_linemap_create): Initialize pointers in initial source_info array. Unless these are initialized to 0, yasm_linemap_destroy() attempts to free these (invalid) pointers. svn path=/trunk/yasm/; revision=1170 --- diff --git a/libyasm/linemgr.c b/libyasm/linemgr.c index f92f1516..6cccd598 100644 --- a/libyasm/linemgr.c +++ b/libyasm/linemgr.c @@ -120,6 +120,7 @@ yasm_linemap_set(yasm_linemap *linemap, const char *filename, yasm_linemap * yasm_linemap_create(void) { + size_t i; yasm_linemap *linemap = yasm_xmalloc(sizeof(yasm_linemap)); linemap->filenames = HAMT_create(yasm_internal_error_); @@ -136,6 +137,10 @@ yasm_linemap_create(void) linemap->source_info_size = 2; linemap->source_info = yasm_xmalloc(linemap->source_info_size * sizeof(line_source_info)); + for (i=0; isource_info_size; i++) { + linemap->source_info[i].bc = NULL; + linemap->source_info[i].source = NULL; + } return linemap; }