Skip to content

Commit

Permalink
stored: avoid memory-leak on malformed use device
Browse files Browse the repository at this point in the history
Previously the UseDeviceCmd() leaked an alist when
the command parsing failed.
  • Loading branch information
arogge committed Mar 7, 2019
1 parent 808cdb6 commit fb2869b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/src/stored/reserve.cc
Expand Up @@ -206,14 +206,14 @@ static bool UseDeviceCmd(JobControlRecord* jcr)
* If there are multiple devices, the director sends us
* use_device for each device that it wants to use.
*/
dirstore = New(alist(10, not_owned_by_alist));
jcr->reserve_msgs = New(alist(10, not_owned_by_alist));
do {
Dmsg1(debuglevel, "<dird: %s", dir->msg);
ok = sscanf(dir->msg, use_storage, StoreName.c_str(), media_type.c_str(),
pool_name.c_str(), pool_type.c_str(), &append, &Copy,
&Stripe) == 7;
if (!ok) { break; }
dirstore = New(alist(10, not_owned_by_alist));
if (append) {
jcr->write_store = dirstore;
} else {
Expand Down

0 comments on commit fb2869b

Please sign in to comment.