projects
/
adu.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
bc400e8
)
Make free_format_info() cope with NULL pointers.
author
Andre Noll
<maan@systemlinux.org>
Sat, 1 Nov 2008 21:55:38 +0000
(22:55 +0100)
committer
Andre Noll
<maan@systemlinux.org>
Sat, 1 Nov 2008 21:55:38 +0000
(22:55 +0100)
Be liberal with what you take, just as the usual free() function.
format.c
patch
|
blob
|
history
diff --git
a/format.c
b/format.c
index 6b7a2f6e2186b8850f2e04abaecff9cb88b3a625..f6b1f48d102d9762696de1345fd61cdce9c83c28 100644
(file)
--- a/
format.c
+++ b/
format.c
@@
-262,11
+262,17
@@
err:
return ret;
}
+/**
+ * It's OK to pass a \p NULL pointer to this function.
+ */
void free_format_info(struct format_info *info)
{
int i;
struct format_item *item;
+ if (!info)
+ return;
+
for (i = 0; (item = info->items[i]); i++) {
if (!item->atom_ptr)
free(item->af.cs.string);