~ubuntu-branches/ubuntu/precise/das-watchdog/precise-security

« back to all changes in this revision

Viewing changes to debian/patches/fix-memory-leak-on-realloc.patch

  • Committer: Package Import Robot
  • Author(s): Tyler Hicks
  • Date: 2015-05-15 12:08:01 UTC
  • Revision ID: package-import@ubuntu.com-20150515120801-z4ha7uy7f8hqnkbn
Tags: 0.9.0-2+deb6u1build0.12.04.1
fake sync from Debian

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Description: Fix memory leak on realloc
 
2
Origin: vendor
 
3
Author: Salvatore Bonaccorso <carnil@debian.org>
 
4
Last-Update: 2015-04-11
 
5
 
 
6
--- a/das_watchdog.c
 
7
+++ b/das_watchdog.c
 
8
@@ -325,7 +325,14 @@ static char *get_pid_environ_val(pid_t p
 
9
 
 
10
     if (i >= temp_size) {
 
11
       temp_size *= 2;
 
12
-      temp = realloc(temp, temp_size);
 
13
+      char *new_temp = realloc(temp, temp_size);
 
14
+      if(new_temp==NULL){
 
15
+        fclose(fp);
 
16
+        free(temp);
 
17
+        return NULL;
 
18
+      }else{
 
19
+        temp=new_temp;
 
20
+      }
 
21
     }
 
22
 
 
23
     if(foundit==1 && (c=='\0' || c==EOF)){