Mark the end of file buffer
authorSung-jae Park <nicesj.park@samsung.com>
Mon, 21 Oct 2013 09:55:32 +0000 (18:55 +0900)
committerSung-jae Park <nicesj.park@samsung.com>
Mon, 21 Oct 2013 09:55:32 +0000 (18:55 +0900)
Change-Id: Ia097463edc4c9d530dfa158d42bd0f0ea73d85f1

packaging/data-provider-master.spec
src/script_handler.c

index 04cf59a..803ba21 100644 (file)
@@ -1,6 +1,6 @@
 Name: data-provider-master
 Summary: Master service provider for liveboxes
-Version: 0.25.17
+Version: 0.25.18
 Release: 1
 Group: HomeTF/Livebox
 License: Flora License
index a4af88c..3d298de 100644 (file)
@@ -1165,7 +1165,7 @@ static inline char *load_file(const char *filename)
                goto errout;
        }
 
-       filebuf = malloc(filesize);
+       filebuf = malloc(filesize + 1);
        if (!filebuf) {
                ErrPrint("malloc: %s\n", strerror(errno));
                goto errout;
@@ -1188,6 +1188,10 @@ static inline char *load_file(const char *filename)
                readsize += ret;
        }
 
+       if (filebuf) {
+               filebuf[readsize] = '\0';
+       }
+
        /*!
         * \note
         * Now, we are ready to parse the filebuf.
@@ -1468,6 +1472,7 @@ HAPI int script_handler_parse_desc(struct inst_info *inst, const char *filename,
                                        state = BEGIN;
                                        block->filename = filename;
                                        block_list = eina_list_append(block_list, block);
+                                       block = NULL;
                        } else {
                                state = FIELD;
                                continue;