Memory usage optimalization - no duplicated paths
authorTomas Mlcoch <tmlcoch@redhat.com>
Mon, 27 Aug 2012 11:05:49 +0000 (13:05 +0200)
committerTomas Mlcoch <tmlcoch@redhat.com>
Mon, 27 Aug 2012 11:05:49 +0000 (13:05 +0200)
src/load_metadata.c

index f47b4de..85045b1 100644 (file)
@@ -705,8 +705,8 @@ fil_end_handler(void *data, const char *el)
                 file = cr_package_file_new();
                 filename = cr_get_filename(txt);
                 file->name = g_string_chunk_insert(pkg->chunk, filename);
-                file->path = g_string_chunk_insert_len(pkg->chunk, txt,
-                                                (txtlen - strlen(filename)));
+                txt[txtlen-strlen(filename)] = '\0';
+                file->path = g_string_chunk_insert_const(pkg->chunk, txt);
 
                 if (ppd->last_elem == FILE_ELEM) {
                     file->type = NULL; // "file";