Merge lp:~jamesodhunt/upstart/async-fix-job-new-destructor into lp:upstart/async

Proposed by Dimitri John Ledkov
Status: Merged
Merged at revision: 1655
Proposed branch: lp:~jamesodhunt/upstart/async-fix-job-new-destructor
Merge into: lp:upstart/async
Diff against target: 51 lines (+11/-9)
2 files modified
init/job.c (+9/-5)
init/tests/test_event.c (+2/-4)
To merge this branch: bzr merge lp:~jamesodhunt/upstart/async-fix-job-new-destructor
Reviewer Review Type Date Requested Status
Dimitri John Ledkov Pending
Review via email: mp+220643@code.launchpad.net

This proposal supersedes a proposal from 2014-05-22.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'init/job.c'
2--- init/job.c 2014-05-21 22:38:34 +0000
3+++ init/job.c 2014-05-22 13:22:47 +0000
4@@ -95,14 +95,15 @@
5 /* Free any associated NihIo's to avoid the handlers getting
6 * called potentially after the job has been freed.
7 */
8- for (i = 0; i < PROCESS_LAST; i++) {
9- if (job->process_data && job->process_data[i]) {
10- nih_free (job->process_data[i]);
11+ if (job->process_data) {
12+ for (i = 0; i < PROCESS_LAST; i++) {
13+ if (job->process_data[i]) {
14+ nih_free (job->process_data[i]);
15
16- job->process_data[i] = NULL;
17+ job->process_data[i] = NULL;
18+ }
19 }
20 }
21-
22 nih_list_destroy (&job->entry);
23
24 return 0;
25@@ -141,6 +142,9 @@
26
27 nih_list_init (&job->entry);
28
29+ /* Ensure unset before destructor could possibly be called */
30+ job->process_data = NULL;
31+
32 nih_alloc_set_destructor (job, job_destroy);
33
34 job->name = nih_strdup (job, name);
35
36=== modified file 'init/tests/test_event.c'
37--- init/tests/test_event.c 2014-05-21 22:38:34 +0000
38+++ init/tests/test_event.c 2014-05-22 13:22:47 +0000
39@@ -1730,10 +1730,8 @@
40 nih_hash_add (job_classes, &class->entry);
41 }
42
43- //FIXME must run without TEST_ALLOC_SAFE
44- TEST_ALLOC_SAFE {
45- event_poll ();
46- }
47+ event_poll ();
48+
49 TEST_FREE (event);
50
51 TEST_HASH_NOT_EMPTY (class->instances);

Subscribers

People subscribed via source and target branches

to all changes: