summaryrefslogtreecommitdiff
path: root/lib/backend
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2009-09-16 12:27:12 +0300
committerPanu Matilainen <pmatilai@redhat.com>2009-09-16 15:47:10 +0300
commit90a0f752808d166e7d1640d60cd3a7d4cd26154e (patch)
treebd834fe23f6007e9a58dc8c02697c0eabd717690 /lib/backend
parent961ced7a611000b8a3d522ddc92c6230b4367e1f (diff)
downloadlibrpm-tizen-90a0f752808d166e7d1640d60cd3a7d4cd26154e.tar.gz
librpm-tizen-90a0f752808d166e7d1640d60cd3a7d4cd26154e.tar.bz2
librpm-tizen-90a0f752808d166e7d1640d60cd3a7d4cd26154e.zip
One complicated way to write xstrdup() .. pff
- sqlite backend uses dbi subfile for table name, leave it alone although it is the same as the file name... - allocate + free both file and table name separately
Diffstat (limited to 'lib/backend')
-rw-r--r--lib/backend/sqlite.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/lib/backend/sqlite.c b/lib/backend/sqlite.c
index 4c1262c4d..a47c56915 100644
--- a/lib/backend/sqlite.c
+++ b/lib/backend/sqlite.c
@@ -772,6 +772,7 @@ enterChroot(dbi);
dbi->dbi_stats = _free(dbi->dbi_stats);
dbi->dbi_file = _free(dbi->dbi_file);
+ dbi->dbi_subfile = _free(dbi->dbi_subfile);
dbi->dbi_db = _free(dbi->dbi_db);
leaveChroot(dbi);
@@ -801,7 +802,6 @@ static int sql_open(rpmdb rpmdb, rpmTag rpmtag, dbiIndex * dbip)
const char * sql_errcode;
dbiIndex dbi;
SQL_DB * sqldb;
- size_t len;
int rc = 0;
int xx;
@@ -831,15 +831,8 @@ enterChroot(dbi);
* Make a copy of the tagName result..
* use this for the filename and table name
*/
- {
- char * t;
- len = strlen(dbfile);
- t = xcalloc(len + 1, sizeof(*t));
- (void) stpcpy( t, dbfile );
- dbi->dbi_file = t;
-/* WRONG */
- dbi->dbi_subfile = t;
- }
+ dbi->dbi_file = xstrdup(dbfile);
+ dbi->dbi_subfile = xstrdup(dbfile);
dbi->dbi_mode=O_RDWR;