target: Fix possible memory leak in aptpl_metadata parsing
commit8d2135592d2ab5c8d7764a4f534afac64e563691
authorJoern Engel <joern@logfs.org>
Tue, 2 Sep 2014 21:49:56 +0000 (2 17:49 -0400)
committerNicholas Bellinger <nab@linux-iscsi.org>
Wed, 17 Sep 2014 21:16:54 +0000 (17 14:16 -0700)
tree77607882ed9f636491a8b9617849c660c11b8c9a
parentfdc84d11a278d468052afc8e17523545fafe6c5f
target: Fix possible memory leak in aptpl_metadata parsing

Each case of match_strdup could leak memory if the same argument was
present before.  I am not too concerned, as it would require a
non-sensical combination like "target_lun=foo target_lun=bar", done
with root privileges and even then leak just a few bytes per instance.

But arg_p is different, as it will always leak memory.  Let's plug that
one.  And while at it, replace some &args[0] with args.

Found by coverity.

Signed-off-by: Joern Engel <joern@logfs.org>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
drivers/target/target_core_configfs.c