memory leak fix.
This commit is contained in:
parent
9ab83da108
commit
d47699adff
@ -1,6 +1,6 @@
|
||||
diff -Naurp microcode_ctl-1.17.orig/Makefile microcode_ctl-1.17/Makefile
|
||||
--- microcode_ctl-1.17.orig/Makefile 2007-04-26 06:59:44.000000000 -0400
|
||||
+++ microcode_ctl-1.17/Makefile 2008-02-05 11:22:23.000000000 -0500
|
||||
diff -urpN microcode_ctl-1.17.orig/Makefile microcode_ctl-1.17/Makefile
|
||||
--- microcode_ctl-1.17.orig/Makefile 2011-03-24 10:28:12.553269014 +0100
|
||||
+++ microcode_ctl-1.17/Makefile 2011-03-24 10:28:26.644387088 +0100
|
||||
@@ -20,8 +20,8 @@ DESTDIR =
|
||||
PREFIX = /usr/local
|
||||
|
||||
@ -21,9 +21,9 @@ diff -Naurp microcode_ctl-1.17.orig/Makefile microcode_ctl-1.17/Makefile
|
||||
$(INS) -m 644 $(MICROCODE) $(DESTDIR)$(MICDIR)/microcode.dat
|
||||
|
||||
$(INS) -m 644 $(MANPAGE) $(DESTDIR)$(MANDIR)
|
||||
diff -Naurp microcode_ctl-1.17.orig/microcode_ctl.c microcode_ctl-1.17/microcode_ctl.c
|
||||
--- microcode_ctl-1.17.orig/microcode_ctl.c 2006-06-28 10:51:31.000000000 -0400
|
||||
+++ microcode_ctl-1.17/microcode_ctl.c 2008-02-05 11:21:31.000000000 -0500
|
||||
diff -urpN microcode_ctl-1.17.orig/microcode_ctl.c microcode_ctl-1.17/microcode_ctl.c
|
||||
--- microcode_ctl-1.17.orig/microcode_ctl.c 2011-03-24 10:28:12.553269014 +0100
|
||||
+++ microcode_ctl-1.17/microcode_ctl.c 2011-03-24 10:28:29.244262053 +0100
|
||||
@@ -25,7 +25,7 @@ int print_error_messages=1;
|
||||
#define MAX_MICROCODE 2000000
|
||||
|
||||
@ -33,7 +33,7 @@ diff -Naurp microcode_ctl-1.17.orig/microcode_ctl.c microcode_ctl-1.17/microcode
|
||||
|
||||
static void usage(void)
|
||||
{
|
||||
@@ -52,11 +52,13 @@ static int do_update(char *device, char
|
||||
@@ -52,17 +52,19 @@ static int do_update(char *device, char
|
||||
{
|
||||
FILE *fp;
|
||||
char line_buffer[BUFFER_SIZE];
|
||||
@ -48,8 +48,28 @@ diff -Naurp microcode_ctl-1.17.orig/microcode_ctl.c microcode_ctl-1.17/microcode
|
||||
|
||||
if( (fp=fopen(filename, "r")) == NULL){
|
||||
if(print_error_messages)
|
||||
@@ -101,7 +103,7 @@ static int do_update(char *device, char
|
||||
return errno;
|
||||
fprintf(stderr, "%s: cannot open source file '%s' errno=%d (%s)\n",
|
||||
progname, filename, errno, strerror(errno));
|
||||
- return errno;
|
||||
+ goto end;
|
||||
}
|
||||
|
||||
pos = microcode;
|
||||
@@ -84,7 +86,7 @@ static int do_update(char *device, char
|
||||
fprintf(stderr, "%s: file too large for utility microcode buffer\n"
|
||||
"%s: change MAX_MICROCODE yourself :)\n", progname, progname);
|
||||
fclose(fp);
|
||||
- return errno;
|
||||
+ goto end;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -98,16 +100,16 @@ static int do_update(char *device, char
|
||||
if(print_error_messages)
|
||||
fprintf(stderr, "%s: cannot open %s for writing errno=%d (%s)\n",
|
||||
progname, device, errno, strerror(errno));
|
||||
- return errno;
|
||||
+ goto end;
|
||||
}
|
||||
|
||||
- if( (wrote = write(outfd, µcode, length)) < 0){
|
||||
@ -57,3 +77,19 @@ diff -Naurp microcode_ctl-1.17.orig/microcode_ctl.c microcode_ctl-1.17/microcode
|
||||
if(print_error_messages)
|
||||
fprintf(stderr, "%s: error writing to '%s' errno=%d (%s)\n"
|
||||
"%s: there may be messages from the driver in your system log.\n",
|
||||
progname, device, errno, strerror(errno), progname);
|
||||
close(outfd);
|
||||
- return errno;
|
||||
+ goto end;
|
||||
}
|
||||
|
||||
if((wrote == length) && print_normal_messages)
|
||||
@@ -116,6 +118,8 @@ static int do_update(char *device, char
|
||||
|
||||
close(outfd);
|
||||
|
||||
+end:
|
||||
+ free(microcode);
|
||||
return errno;
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
Summary: Tool to update x86/x86-64 CPU microcode.
|
||||
Name: microcode_ctl
|
||||
Version: 1.17
|
||||
Release: 12%{?dist}
|
||||
Release: 13%{?dist}
|
||||
Epoch: 1
|
||||
Group: System Environment/Base
|
||||
License: GPLv2+ and Redistributable, no modification permitted
|
||||
@ -73,7 +73,10 @@ rm -rf %{buildroot}
|
||||
exit 0
|
||||
|
||||
|
||||
%changelog
|
||||
%changeloga
|
||||
* Thu Mar 24 2011 Anton Arapov <anton@redhat.com> 1.17-13
|
||||
- fix memory leak.
|
||||
|
||||
* Mon Mar 07 2011 Anton Arapov <anton@redhat.com> 1.17-12
|
||||
- Update to amd-ucode-2011-01-11.tar
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user