Skip to content

Commit

Permalink
Merge pull request #18 from t6/master
Browse files Browse the repository at this point in the history
Plug memory leak in handle_targets
  • Loading branch information
kfish authored Sep 2, 2016
2 parents e251314 + 4a7e07a commit ca00b8e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions xsel.c
Original file line number Diff line number Diff line change
Expand Up @@ -1395,14 +1395,16 @@ handle_targets (Display * display, Window requestor, Atom property,
Atom selection, Time time, MultTrack * mparent)
{
Atom * targets_cpy;
HandleResult r;

targets_cpy = malloc (sizeof (supported_targets));
memcpy (targets_cpy, supported_targets, sizeof (supported_targets));

return
change_property (display, requestor, property, XA_ATOM, 32,
r = change_property (display, requestor, property, XA_ATOM, 32,
PropModeReplace, (unsigned char *)targets_cpy,
NUM_TARGETS, selection, time, mparent);
free(targets_cpy);
return r;
}

/*
Expand Down

0 comments on commit ca00b8e

Please sign in to comment.