diff --git a/.pick_status.json b/.pick_status.json index cfffdc84512..520c599ca1c 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -2434,7 +2434,7 @@ "description": "drisw: Properly mark shmid as -1 when alloc fails", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/gallium/winsys/sw/dri/dri_sw_winsys.c b/src/gallium/winsys/sw/dri/dri_sw_winsys.c index 0b2c8754ec5..d7b2453eaa2 100644 --- a/src/gallium/winsys/sw/dri/dri_sw_winsys.c +++ b/src/gallium/winsys/sw/dri/dri_sw_winsys.c @@ -108,15 +108,19 @@ alloc_shm(struct dri_sw_displaytarget *dri_sw_dt, unsigned size) /* 0600 = user read+write */ dri_sw_dt->shmid = shmget(IPC_PRIVATE, size, IPC_CREAT | 0600); - if (dri_sw_dt->shmid < 0) + if (dri_sw_dt->shmid < 0) { + dri_sw_dt->shmid = -1; return NULL; + } addr = (char *) shmat(dri_sw_dt->shmid, NULL, 0); /* mark the segment immediately for deletion to avoid leaks */ shmctl(dri_sw_dt->shmid, IPC_RMID, NULL); - if (addr == (char *) -1) + if (addr == (char *) -1) { + dri_sw_dt->shmid = -1; return NULL; + } return addr; }