diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2010-05-06 14:55:38 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2010-05-06 15:09:47 +0300 |
commit | 27869a523327475a4f809415753e1ec091093d4a (patch) | |
tree | f15cc43590e86224e653b166d63b81ba6987ff44 /lib/rpmfs.c | |
parent | 63dcd3d4973906eccd76129d194fabea34faece9 (diff) | |
download | librpm-tizen-27869a523327475a4f809415753e1ec091093d4a.tar.gz librpm-tizen-27869a523327475a4f809415753e1ec091093d4a.tar.bz2 librpm-tizen-27869a523327475a4f809415753e1ec091093d4a.zip |
Tolerate NULL in rpmfsFree() and rpmfsFC()
- both are "can't happen" situations but easy to handle cleanly here...
Diffstat (limited to 'lib/rpmfs.c')
-rw-r--r-- | lib/rpmfs.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/lib/rpmfs.c b/lib/rpmfs.c index f5d478817..f07603a35 100644 --- a/lib/rpmfs.c +++ b/lib/rpmfs.c @@ -26,17 +26,20 @@ rpmfs rpmfsNew(unsigned int fc, rpmElementType type) return fs; } -rpmfs rpmfsFree(rpmfs fs) { - fs->replaced = _free(fs->replaced); - fs->states = _free(fs->states); - fs->actions = _free(fs->actions); - - fs = _free(fs); - return fs; +rpmfs rpmfsFree(rpmfs fs) +{ + if (fs != NULL) { + fs->replaced = _free(fs->replaced); + fs->states = _free(fs->states); + fs->actions = _free(fs->actions); + fs = _free(fs); + } + return NULL; } -rpm_count_t rpmfsFC(rpmfs fs) { - return fs->fc; +rpm_count_t rpmfsFC(rpmfs fs) +{ + return (fs != NULL) ? fs->fc : 0; } void rpmfsAddReplaced(rpmfs fs, int pkgFileNum, int otherPkg, int otherFileNum) |